Log rotating with a Bash script

前端 未结 5 1570
时光取名叫无心
时光取名叫无心 2021-02-01 20:09

I have the following issue:

I have an application, which continuously produces output to stderr and stdout. The output of this application is captured in a logfile (the

5条回答
  •  悲&欢浪女
    2021-02-01 20:28

    I wrote a logrotee this weekend. I probably wouldn't if I've read @JdeBP's great answer about multilog before.

    I focused on it being lightweight and being able to bzip2 its output chunks like:

    verbosecommand | logrotee  \
      --compress "bzip2 {}" --compress-suffix .bz2 \
      /var/log/verbosecommand.log
    

    There's a lot of to be done and tested yet, though.

提交回复
热议问题