Skip to content

add --grep option to parse logs stream output for match#90

Open
rveve wants to merge 1 commit intojohanhaleby:masterfrom
rveve:master
Open

add --grep option to parse logs stream output for match#90
rveve wants to merge 1 commit intojohanhaleby:masterfrom
rveve:master

Conversation

@rveve
Copy link

@rveve rveve commented Apr 30, 2019

No description provided.

@rveve
Copy link
Author

rveve commented Apr 30, 2019

Need a --grep or any generic program that can can parse output and find matches.

kubetail -l app=hello-node-w101-wave -n opsnondev -c hello-node --grep foo
Will tail 3 logs...
hello-node-w101-wave-7c6bb94cc5-2q79m
hello-node-w101-wave-7c6bb94cc5-s74lv
hello-node-w101-wave-7c6bb94cc5-thrxc
[hello-node-w101-wave-7c6bb94cc5-s74lv] Received request for URL: /foo/ 
[hello-node-w101-wave-7c6bb94cc5-s74lv] Received request for URL: /foo/ 
[hello-node-w101-wave-7c6bb94cc5-s74lv] Received request for URL: /foo/ 
[hello-node-w101-wave-7c6bb94cc5-s74lv] Received request for URL: /foo/ 
[hello-node-w101-wave-7c6bb94cc5-s74lv] Received request for URL: /foo/ 
kubetail -l app=api-service-dev -n core -c api-service --grep '\-i error' --jq '.logger_name'
Will tail 21 logs...
api-service-dev-758b4f86dc-4x76g
api-service-dev-758b4f86dc-6kkxv
api-service-dev-758b4f86dc-7fpmf
api-service-dev-758b4f86dc-9mpqs
api-service-dev-758b4f86dc-b58gx
api-service-dev-758b4f86dc-c9pqs
api-service-dev-758b4f86dc-ccbhk
api-service-dev-758b4f86dc-gtggb
api-service-dev-758b4f86dc-kb8bm
api-service-dev-758b4f86dc-kdg74
api-service-dev-758b4f86dc-l8wgz
api-service-dev-758b4f86dc-nf447
api-service-dev-758b4f86dc-njx4x
api-service-dev-758b4f86dc-pjn6g
api-service-dev-758b4f86dc-rgw4h
api-service-dev-758b4f86dc-rzlgl
api-service-dev-758b4f86dc-whhq9
api-service-dev-758b4f86dc-wn4lz
api-service-dev-758b4f86dc-wvjb2
api-service-dev-758b4f86dc-x6j6r
api-service-dev-758b4f86dc-xn87x
[api-service-dev-758b4f86dc-6kkxv] controllers.ProgramSettingsController 
[api-service-dev-758b4f86dc-pjn6g] controllers.ProgramSettingsController 
[api-service-dev-758b4f86dc-x6j6r] controllers.ProgramSettingsController 
[api-service-dev-758b4f86dc-b58gx] controllers.ProgramSettingsController 
[api-service-dev-758b4f86dc-xn87x] controllers.ProgramSettingsController 
[api-service-dev-758b4f86dc-6kkxv] controllers.ProgramSettingsController 
[api-service-dev-758b4f86dc-kdg74] controllers.ProgramSettingsController 
[api-service-dev-758b4f86dc-xn87x] controllers.ProgramSettingsController 
[api-service-dev-758b4f86dc-kb8bm] controllers.ProgramSettingsController 

@mreza-kiani
Copy link

Please accept this merge! It's really useful

@johanhaleby
Copy link
Owner

johanhaleby commented Oct 9, 2019

Please explain why you just can't pipe to grep? For example:

kubetail my-pod | grep hello

This seems to work well for me on Mac and a colleague is using it fine on Linux too.

@mreza-kiani
Copy link

Yes, now I get it works correctly for me too. Because kubetail stats from the end of the current log, I couldn't receive any log when I used | grep pipe due to rare occurrence of the event. So it was my fault, and I'm sorry about it.
Thanks for your respond

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants