Last active
December 21, 2015 02:58
-
-
Save masutaka/6238387 to your computer and use it in GitHub Desktop.
Nginx(LTSV log) -> fluentd -> MongoDB
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| gem_package 'fluent-plugin-mongo' do | |
| gem_binary '/usr/lib/fluent/ruby/bin/fluent-gem' | |
| action :install | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| log_format ltsv "time:$time_local" | |
| "\thost:$remote_addr" | |
| "\tforwardedfor:$http_x_forwarded_for" | |
| "\treq:$request" | |
| "\tstatus:$status" | |
| "\tsize:$body_bytes_sent" | |
| "\treferer:$http_referer" | |
| "\tua:$http_user_agent" | |
| "\treqtime:$request_time" | |
| "\tvhost:$host"; | |
| access_log /var/www/vhosts/masutaka.net/logs/access.log ltsv; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <source> | |
| type tail | |
| format ltsv | |
| time_format %d/%b/%Y:%H:%M:%S %z | |
| path /var/www/vhosts/masutaka.net/logs/access.log | |
| tag nginx.access.masutaka.net | |
| pos_file /var/log/td-agent/nginx.masutaka.net.pos | |
| </source> | |
| <match nginx.access.masutaka.net> | |
| type mongo | |
| host localhost | |
| database fluent | |
| collection nginx | |
| </match> |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
http://masutaka.net/chalow/2013-07-14-1.html