-
Notifications
You must be signed in to change notification settings - Fork 96
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
document support for setting severity #51
Comments
We've had a TODO to document this properly, but the short answer is yes, you can use a regexp (or json) to set the severity for a log entry, the key is 'severity' (#4 also discusses making that name configurable). http://docs.fluentd.org/articles/in_tail has generic documentation on how to do this. The value of 'severity' ultimately has to be one of the enum values accepted by the Cloud Logging API as documented here. However, the plugin also has a list of translations from other common values (WARN=WARNING, FINE=DEBUG, etc). Case is ignored in all cases. Numeric values will also be translated into valid severity values (0=DEFAULT, 100=INFO, ... 800=EMERGENCY). Values are rounded down to the nearest 100, and anything >=800 maps to EMERGENCY. |
Does anyone have any examples on how to do this for the syslog config file? It would be cool if the default syslog could get the severity parsed. I am having trouble with the format regex. |
A typical GCP instance has syslog formatted as below:
A sample syslog format is also included there:
Hope this helps. |
@qingling128 Thanks for your response. The syslog format is what i was having trouble with. Although pretty ugly i finally got stackdriver syslogs to show severity. I probably could have used look(ahead|behind)s to remove the duplication but regex isn't my strong suit.
I still don't understand why the format from the examples like the one you posted do not have |
@j-walker23, you can remove the |
Sorry about accidentally closing this — fat-fingered the "Close and comment" button in the mobile UI... |
@igorpeshansky awesome, thanks for explaining why. That makes sense. Because i don't control all log formats to syslog the severity can be anywhere after the time if at all. That was the only way i could get it to work was by having the optional any char repeater excluding the severities to be able to pick up in all scenarios. |
@j-walker23, I was talking specifically about the square-bracketed group I've quoted, which is effectively equivalent to |
Gotcha. Thanks for your help. |
Just in case someone might find it useful, had similar issue/requirement, managed to solve it, here is the solution: |
@igorpeshansky can you see if there's something left to do. |
Splitting this off from #43 from @sadovnychyi
Is it possible to capture severity information using regexp like
format /^(?<message>(?<time>[^ ]*\s*[^ ]* [^ ]*) .*)$/
in config file?That sample is used to capture timestamp from syslogs, but does not seems to work properly. WOuld like to see documentation about this.
The text was updated successfully, but these errors were encountered: