Skip to content

Instantly share code, notes, and snippets.

@gotomypc
Forked from y-ken/nginx.conf
Last active August 29, 2015 14:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gotomypc/421c5e9167975bc65a08 to your computer and use it in GitHub Desktop.
Save gotomypc/421c5e9167975bc65a08 to your computer and use it in GitHub Desktop.
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