S Boulden
S Boulden

Reputation: 11

Filtering streaming Openshift logs

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.

Upvotes: 1

Views: 216

Answers (1)

Jiri Fiala
Jiri Fiala

Reputation: 1400

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.

Upvotes: 0

Related Questions