Use MongoDB to store Docker logs (cont.) storage

Source: Internet
Author: User
Tags mongodb fluentd

The basic configuration of Docker + Fluentd + MongoDB was completed in the previous article, "Using the MongoDB storage Docker log." However, in the actual use of the process, but found that Docker generated logs are not immediately written to the MongoDB, there are about 1 minutes of delay.

Consult the FLUENTD documentation to learn that there is a flush parameter that controls the write frequency of the log, and the default is 60s. Changing the Flush_interval parameter can increase the write frequency, as follows:

# # Match tag=docker.* and dump to console
<match docker.*>
  @type MONGO
  host 127.0.0.1
  Port 22017< C4/>database Docker
  Collection log
  <buffer>
    flush_mode interval flush_interval
    1s
  </ Buffer>
</match>

Just beginning to understand the document is not very thorough, increased the flush_interval parameters, and did not play a role, the first time the change, did not put Flush_mode and flush_interval in the buffer structure. Is

# # Match tag=docker.* and dump to console
<match docker.*>
  @type MONGO
  host 127.0.0.1
  Port 22017
  Database Docker
  collection log
  flush_mode interval
  flush_interval 1s
</match>

The above configuration can also be seen from the log and does not work:

2018-01-19 14:33:32 +0800 [warn]: Parameter ' **flush_mode** ' in <match docker.*>
  @type MONGO
  Host " 1270.0.0.1 "
  Port 22017
  database" Docker "
  Collection" Log "
  flush_mode interval
  1s
  buffer_chunk_limit 8m
  time_key time
  <inject>
    time_key time
    time_format%y-%m-%d%h:%m: %s.%l
  </inject>
</match> is not used.

It says Flush_mode doesn't work.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.