Skip to content

Instantly share code, notes, and snippets.

@masutaka
Last active December 21, 2015 02:58
Show Gist options
  • Select an option

  • Save masutaka/6238486 to your computer and use it in GitHub Desktop.

Select an option

Save masutaka/6238486 to your computer and use it in GitHub Desktop.
Nginx(LTSV log) -> fluentd -> (MongoDB and GrowthForecast)
%w(fluent-plugin-mongo fluent-plugin-growthforecast).each do |pkg|
gem_package pkg do
gem_binary '/usr/lib/fluent/ruby/bin/fluent-gem'
action :install
end
end
<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.**>
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>
</match>
@masutaka

Copy link
Copy Markdown
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment