Skip to content
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

Add <log> directive to <system> #1644

Merged
merged 2 commits into from
Jul 28, 2017
Merged

Add <log> directive to <system> #1644

merged 2 commits into from
Jul 28, 2017

Conversation

repeatedly
Copy link
Member

@repeatedly repeatedly commented Jul 26, 2017

This directive controls fluentd's log behaviour
Now, support two parameters:

<system>
  <log>
    format json
    time_format %F
  </log>
</system>
  • format: Change fluentd log format. text and json

text:

2017-07-27 07:37:02 +0900 [info]: #0 fluentd worker is now running worker=0

json:

{"time":"2017-07-27 06:44:54 +0900","level":"info","message":"fluentd worker is now running worker=0","worker_id":0}
  • time_format: Change time format of log

time_format %Y

2017 [info]: #0 fluentd worker is now running worker=0

I have a plan to move some logging related parameters to under <log> like log_level.

@repeatedly repeatedly requested a review from mururu July 26, 2017 22:40
@repeatedly repeatedly added feature request *Deprecated Label* Use enhancement label in general v0.14 labels Jul 26, 2017
@time_format = nil
@formatter = nil

self.format = :text
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not @format = :text?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see.

@mururu
Copy link
Member

mururu commented Jul 27, 2017

I added a very small comment. Other than that LGTM.

@@ -426,7 +491,7 @@ def caller_line(type, time, depth, level)
else
"".freeze
end
log_msg = "#{time.strftime(@time_format)}[#{LEVEL_TEXT[level]}]: #{worker_id_part}"
log_msg = "#{time.strftime(@time_format)} [#{LEVEL_TEXT[level]}]: #{worker_id_part}"
Copy link

@vkaverin vkaverin Jul 27, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can't this log pattern be customizable as well?
For example, it may be necessary to have patten like [time][log_level] message to parse it easily.

It could be a customizable part of text format or a new format, let's say custom.

Copy link
Member Author

@repeatedly repeatedly Jul 28, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For example, it may be necessary to have patten like [time][log_level] message to parse it easily.

For easy to parse, format json is enough.

@vkaverin
Copy link

Will there be any documentation updates? Unfortunately, I'm not deeply familiar with the repository's structure, but I didn't where the docs are stored.

@repeatedly
Copy link
Member Author

Visit fluentd-docs repository.

@repeatedly repeatedly merged commit 6e89d3f into master Jul 28, 2017
@repeatedly repeatedly deleted the system-log-directive branch November 14, 2017 23:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request *Deprecated Label* Use enhancement label in general v0.14
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants