生成结果~
1、nginx配置埋点日志单独存放
在nginx配置里的server内添加location指向,$day变量是分割日志的,后面有。
location /t.gif {
access_log /home/gif.logs/123.com.access_$day.log combined;
error_log /home/gif.logs/123.com.error_$day.log;
}
2.配置日志分割,按每天生成
同样在nginx的server段内添加以下内容
if ($time_iso8601 ~ "(\d{4}-\d{2}-\d{2})") {
set $day $1;
}