1

I'm trying to tail the Openshift logs using the rhc CLI tool, and grep the streaming results for certain keywords.

I've had a search around, and thought the --line-buffered flag for grep would solve my problem.

I've tried using the following:

rhc tail -o "-n 50" -a <app-name> | grep --line-buffered 'word1\|word2'

While this returns the first 50 filtered lines from the aggregated Openshift log, it doesn't update with any additional content.

Note that I deliberately haven't specified the -f flag; the follow flag is implicit per the rhc/tail.rb code: https://github.com/openshift/rhc/blob/master/lib/rhc/commands/tail.rb

Has anyone had any luck filtering streaming Openshift logs?

Any assistance is greatly appreciated.

1 Answer 1

0

If you don't mind monitoring the log remotely, you can ssh into your app by rhc ssh <yourApp> and when you're there, something like tail -f ~/app-root/logs/* | grep your_pattern to check all logs continuously for your_pattern.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.