Skip to content

Instantly share code, notes, and snippets.

@sergeycherepanov
Created January 19, 2018 20:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sergeycherepanov/01a04a26f21b40007b5a4810c3e53fa6 to your computer and use it in GitHub Desktop.
Save sergeycherepanov/01a04a26f21b40007b5a4810c3e53fa6 to your computer and use it in GitHub Desktop.

fluentd.conf

<source>
  @type tail
  path /tmp/log-test.log #...or where you placed your Apache access log
  pos_file /tmp/log-test.log.pos # This is where you record file position
  tag foobar.json #fluentd tag!
  format json # one JSON per line
  time_key time_field # optional; default = time
</source>

<match **>
  @type stdout
</match>

create log file

touch /tmp/log-test.log

run

td-agent -c ./config.conf

write data to file

echo '{"time":1362020400,"host":"192.168.0.1","size":777,"method":"PUT"}' >> /tmp/log-test.log
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment