Skip to content

Instantly share code, notes, and snippets.

@sahilsk
Created March 15, 2016 10:00
Show Gist options
  • Save sahilsk/e547544559212a83c981 to your computer and use it in GitHub Desktop.
Save sahilsk/e547544559212a83c981 to your computer and use it in GitHub Desktop.
fluent sample configuration
##########################################
#### input
##########################################
# syslog logging
<source>
type tail
path /var/log/syslog, /var/log/auth.log, /var/log/kern.log
pos_file /tmp/td-agent/pos/syslog
refresh_interval 1
read_from_head True
tag system
format syslog
</source>
# activity logging
<source>
type tail
path /var/log/activity.log
pos_file /tmp/td-agent/pos/activity.log
refresh_interval 1
read_from_head True
tag activity_log
format /^(?<time>[^ ]* *[^ ]* [^ ]* [^ ]*) (?<host>[^ ]*) (?<ident>[a-zA-Z0-9_\/\.\-]*)(?:\[(?<pid>[0-9]+)\])?[^\:]*\: *(?<connection>.*); *USERNAME: (?<username>.*); *PWD: (?<pwd>.*); *COMMAND: (?<command>.*)$/
</source>
# application logging
<source>
type tail
path /var/log/php5-fpm.log, /var/log/practo-account.log, /var/log/practo-account-latest.log
pos_file /tmp/td-agent/pos/application.log
refresh_interval 1
read_from_head True
tag application_log
format none
</source>
# Ship nginx logs to graylog
<source>
type tail
format nginx
path /mnt/logs/nginx/*.log
tag graylog2.prod-web-router
</source>
##########################################
#### output
##########################################
######
#### system
######
<system>
log_level trace
</system>
# Match for all syslog Group
<match system.**>
type copy
<store>
type stdout
</store>
<store>
type gelf
host 10.0.1.118
port 12201
</store>
</match>
######
#### activity_log
######
<activity_log>
log_level trace
</activity_log>
<match activity_log.**>
type copy
<store>
type stdout
</store>
<store>
type gelf
host 10.0.1.118
port 12201
</store>
</match>
######
#### application_log
######
<application_log>
log_level trace
</application_log>
<match application_log.**>
type copy
<store>
type stdout
</store>
<store>
type gelf
host 10.0.1.118
port 12201
</store>
</match>
######
### prod-web -> graylog
######
<match graylog2.**>
type copy
<store>
type gelf
host 10.0.1.118
port 12201
flush_interval 5s
</store>
</match>
##########################################
#### includes
##########################################
@include /etc/td-agent/conf.d/*
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment