Skip to content

Instantly share code, notes, and snippets.

@glidenote
Created May 19, 2012 20:59
Show Gist options
  • Save glidenote/2732356 to your computer and use it in GitHub Desktop.
Save glidenote/2732356 to your computer and use it in GitHub Desktop.
fluentd conf files
# appサーバ用の設定
<source>
type tail
path /var/log/nginx/access.log
format apache
tag nginx.access
pos_file /var/log/td-agent/nginx.pos
</source>
<match nginx.access>
type forward
<server>
host xxx.xxx.xxx.xxx
</server>
</match>
# fluentd setting
-A RH-Firewall-1-INPUT -m state --state NEW -s xxx.xxx.xxx.xxx -m tcp -p tcp --dport 24224 -j ACCEPT
-A RH-Firewall-1-INPUT -m state --state NEW -s xxx.xxx.xxx.xxx -m udp -p udp --dport 24224 -j ACCEPT
# logサーバ用設定(mongodb)
<source>
type forward
port 24224
</source>
<match nginx.access>
type mongo
database nginx
collection access
host 127.0.0.1
port 27017
flush_interval 10s
</match>
# log収集用サーバの設定
<source>
type forward
port 24224
</source>
<match nginx.access>
type file
path /var/log/td-agent/access_log
</match>
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent"';
# 1台で動かす場合の設定
<source>
type tail
path /var/log/nginx/access.log
format apache
tag nginx.access
pos_file /var/log/td-agent/nginx.pos
</source>
<match nginx.access>
type file
path /var/log/td-agent/access_log
</match>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment