Created
August 15, 2013 05:40
-
-
Save masutaka/6238537 to your computer and use it in GitHub Desktop.
Nginx(LTSV log) -> fluentd -> (MongoDB and GrowthForecast) part2
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
| %w(fluent-plugin-mongo fluent-plugin-growthforecast fluent-plugin-datacounter).each do |pkg| | |
| gem_package pkg do | |
| gem_binary '/usr/lib/fluent/ruby/bin/fluent-gem' | |
| action :install | |
| end | |
| 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
| <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 copy | |
| <store> | |
| type mongo | |
| host localhost | |
| database fluent | |
| collection nginx | |
| </store> | |
| <store> | |
| type growthforecast | |
| gfapi_url http://localhost:5125/api/ | |
| service nginx | |
| section response | |
| name_keys reqtime | |
| </store> | |
| <store> | |
| type datacounter | |
| unit minute | |
| tag nginx.status_count.masutaka.net | |
| count_key status | |
| pattern1 2xx ^2\d\d$ | |
| pattern2 3xx ^3\d\d$ | |
| pattern3 4xx ^4\d\d$ | |
| pattern4 5xx ^5\d\d$ | |
| </store> | |
| </match> | |
| <match nginx.status_count.masutaka.net> | |
| type growthforecast | |
| gfapi_url http://localhost:5125/api/ | |
| service nginx | |
| section status_count | |
| name_keys nginx.access.masutaka.net_2xx_count,nginx.access.masutaka.net_3xx_count,nginx.access.masutaka.net_4xx_count,nginx.access.masutaka.net_5xx_count | |
| </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-08-15-1.html