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

Flush_interval doesn't work after set up timekey. #2766

Closed
yuchen9459 opened this issue Jan 9, 2020 · 2 comments
Closed

Flush_interval doesn't work after set up timekey. #2766

yuchen9459 opened this issue Jan 9, 2020 · 2 comments

Comments

@yuchen9459
Copy link

Describe the bug
Since I would like to set the index name as the format fluentd.${tag}.%Y%m, I need to set up the timekey for the buffer. However, after setting up the timekey, the flush_interval stops to work. It takes much longer to dump the data to the elastic search. If I remove the timekey setup, the log records can be dumped to elastic search immediately, while the index_name isn't correct.

To Reproduce
Fluentd config file:

<source>
  @type tail
  path /var/log/test.log
  pos_file /var/log/td-agent/test.log.pos
  tag logtest
  read_from_head true
  <parse>
     @type json
   </parse>
</source>
<match logtest>
   @type elasticsearch
   host localhost
   port 9200
   index_name fluentd.${tag}.%Y%m
   <buffer tag, time>
     timekey 5s
     flush_interval 5s
   </buffer>
</match>

Log file example:

{"asctime": "2020-01-07 15:21:36", "levelname": "INFO", "message": "Watcher Stop", "module": "watcher.watcher", "action": "Watcher is stopped"}
{"asctime": "2020-01-07 15:21:37", "levelname": "INFO", "message": "Watcher Start", "module": "watcher.watcher", "action": "Watcher is started"}
{"asctime": "2020-01-07 15:21:38", "levelname": "INFO", "message": "Observing: test/data/receive", "module": "watcher.watcher", "action": "Watcher Schedules"}

Expected behavior
The log records should be dumped into elastic search quickly, rather than takes around 1 min.

Your Environment

  • Fluentd-1.7.4
  • Operating system: Windows10
@repeatedly
Copy link
Member

repeatedly commented Jan 11, 2020

Set flush_mode interval in <buffer>.
You see following message in fluentd logs.

'flush_interval' is ignored because default 'flush_mode' is not 'interval': 'lazy'

@yuchen9459
Copy link
Author

yuchen9459 commented Jan 13, 2020

Set flush_mode interval in <buffer>.
You see following message in fluentd logs.

'flush_interval' is ignored because default 'flush_mode' is not 'interval': 'lazy'

Thanks for your response. I removed the timekey attribute from the buffer section and change the flush_mode into immediate. In this case, even though the index was created immediately when I start the fluentd, the new records were not inserted into index immediately when there're new records appended to the log file. Do you know the possible reason for that?

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

No branches or pull requests

2 participants