docker 镜像内路径:/var/log/nginx

 

在 nginx.conf 中配置日志按时间生成(在 server 节点中插入以下配置,未验证):

if ($time_iso8601 ~ "^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2})")
{
    set $year $1;
    set $month $2;
    set $day $3;
    set $hour $4;
    set $minutes $5;
    set $seconds $6;
}
#访问日志 按小时
access_log /var/log/nginx/$year-$month-$day-access.log;
#错误日志
error_log /var/log/nginx/$year-$month-$day-error.log;

 

更多:https://zhuanlan.zhihu.com/p/48943836

https://www.jianshu.com/p/c136c7ec2572

相关文章:

  • 2022-12-23
  • 2021-05-22
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-11-13
猜你喜欢
  • 2022-01-30
  • 2021-09-23
  • 2022-12-23
  • 2022-01-01
  • 2021-07-09
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案