-
Notifications
You must be signed in to change notification settings - Fork 8
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
How can I create a custom log format for JSON files like say one for logstash? #29
Comments
So to achieve this, you have to create your own Layout. This is pretty straight forward, but you need to know a bit about R6 classes and the inner workings of lgr [that are properly not documented sufficiently]. Basically you just have to inherit from
This is also a nicer place to label the levels with |
edit: I forgott hat you can just use |
I say the custom format for logstash, like done by NodeJS logger Winston (https://github.com/winstonjs/logform#logstash).
This would be look something like so:
{"@message":"analysis status updated to processing ","@timestamp":"2019-11-23T21:39:41.853Z","@fields":{"level":"info","IP":"128.95.204.113"}}
This isnt, ofcourse, too critical as logstash can parse the JSON generated by
lgr
. Wanted to understand how I can totally transform the log format. I am able to add custom fields right now.The text was updated successfully, but these errors were encountered: