使用管道和cronolog切割日志

时间:2022-03-07 15:09:48
安装cronolog
git clone https://github.com/fordmason/cronolog
./configure
make && make install
创建管道文件
mkfifo /app/logs/access.log
修改日志写入路径
# 以nginx举例
vim nginx/conf/nginx.conf
    access_log  /app/logs/access.log  main;
启动cronolog
nohup cronolog /app/logs/access.log.%Y-%m-%d < /app/logs/access.log >> /dev/null 2>&1 &