Skip to content

Instantly share code, notes, and snippets.

@gotomypc

gotomypc/nginx.conf

Forked from y-ken/nginx.conf
Last active Aug 29, 2015
Embed
What would you like to do?
http {
include /etc/nginx/mime.types;
default_type application/octet-stream;
log_format ltsv 'domain:$host\t'
'host:$remote_addr\t'
'user:$remote_user\t'
'time:$time_local\t'
'method:$request_method\t'
'path:$request_uri\t'
'protocol:$server_protocol\t'
'status:$status\t'
'size:$body_bytes_sent\t'
'referer:$http_referer\t'
'agent:$http_user_agent\t'
'response_time:$request_time\t'
'cookie:$http_cookie\t'
'set_cookie:$sent_http_set_cookie\t'
'upstream_addr:$upstream_addr\t'
'upstream_cache_status:$upstream_cache_status\t'
'upstream_response_time:$upstream_response_time';
access_log /var/log/nginx/access.log ltsv;
...snip...
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $http_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
include /etc/nginx/conf.d/*.conf;
}
<source>
type tail
path /var/log/nginx/access.log
format ltsv
time_format %d/%b/%Y:%H:%M:%S %z
tag td.nginx.access
pos_file /var/log/td-agent/nginx_access.pos
</source>
<source>
type tail
path /var/log/nginx/error.log
format /^(?<time>.+) \[(?<level>[^\]]+)\] *(?<message>.*)$/
time_format %Y/%m/%d %H:%M:%S
tag td.nginx.error
pos_file /var/log/td-agent/nginx_error.pos
</source>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment