-
Notifications
You must be signed in to change notification settings - Fork 152
Add --stdin for stdin log parsing
#292
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weβll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
When Log and TailOptions are used by other classes it is now more obvious that they're not hard lined to Tail.
FileTail is heavily based on Tail but I saw no obvious way to abstract the common parts of the classes to not duplicate them. FileTail is so small it's hardly noticeable anyway.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm sorry for the delayed reply.
This feature will also be great for testing templates π. I would like to incorporate this feature, but I would like to confirm that at least one other maintainer agrees before proceeding. @floryut @rkmathi @superbrothers What do you think?
Thanks for the PR!
Also moving file tailing to main thread as there are no parallel tails with that config.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM π
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry for the late confirmation.
I think this feature is very useful π
|
Awesome, thanks folks! |
Usage:
This PR adds the
--stdinflag for parsing logs fromstdininstead of pulling them from k8s. It creates a new "tail" struct,FileTail, which is heavily based on the originalTail. The new class is quite slim and I didn't find any meaningful way to combine the two, so they are mostly their own separate thing. They do share some helper functions andTailOptionswhich I moved to a "utils" file.It's not uncommon for CLI tools to use
-to read fromstdinbut I didn't find support for that inpflag, and I'm not sure it's better than--stdinanyway. (e.g like vimecho "Hello" | vim -, and for sternstern - < ./service.log)Feedback welcome.
Implements #291