Grep

Using stern together with grep

2019-09-30

I’ve been using stern as my goto log viewer for Kubernetes. It supports multiple pods and other convenient functions on top of kubectl logs. And of course, grepping goes hand in hand with log viewing, doesn’t it? To combine grep with stern, I use the following commands: For OSX: # stern <some-prod-prefix> | grep -i –line-buffered -E '<extended-regex>' $ stern user | grep -i –line-buffered -E 'failed' # For Linux (Ubuntu specifically): # stern <some-prod-prefix> | grep -i -E '<extended-regex>' $ stern user -s 1h | grep -i -E 'error'

Grep · K8s · Logs · Stern

1 minute