kubetail icon indicating copy to clipboard operation
kubetail copied to clipboard

--line-buffered doesn't work

Open pmorch opened this issue 3 years ago • 3 comments

I have a container that spits out a log entry every 5 seconds which is annoying. I want to kubetail $args | grep -v annoying but now new output doesn't show up immediately, but shows up in chunks when the buffer fills up. Conclusion: --line-buffered doesn't work.

This doesn't work:

kubetail container --line-buffered | grep -v somethingelse

But this does:

kubectl logs -l app.kubernetes.io/instance=myinstance -f | grep -v somethingelse

Using

kubetail --version
1.6.13-SNAPSHOT

pmorch avatar Apr 29 '21 04:04 pmorch

Hmm ok maybe it has broken somehow. Really hard to very everything when there are no tests unfortunately. If you're up for it we would really appreciate a PR. If so I can make a new release asap!

johanhaleby avatar Apr 29 '21 04:04 johanhaleby

I have just encountered this too. But for me it only occurs when I'm also using the 'jq' flag and piping that into grep.

kubectl logs -l app.kubernetes.io/instance=myinstance -f --jq  '.LogLevel + " "+ .Message + " "+.Exception'  | grep -v somethingelse

bootandy avatar Feb 15 '22 21:02 bootandy

Update: Fixed my problem by remembering to add '--line-buffered' to grep on the end.

bootandy avatar Feb 15 '22 22:02 bootandy