Topics

log files without date in name


Tom
 

I'm trying to use logrotate to keep the /var/log/mmdvm directory clean. I can not specify a simple log filename because each day the filename (before.log) changes with the date embedded. This occurs with MMDVM_Bridge, P25Gateway, and P25Reflector logs. Since these names are generated outside of logrotate, they are all treated as different logs. Is there a way to not include the date in the log file?
Tom / K5TRA 


Steve N4IRS
 

Direct answer, no you can not.
This is what the updated apt package contains:

/var/log/mmdvm/MMDVM_Bridge.log
{
        daily
        rotate 30
        maxage 30
        dateext
        dateformat -%Y-%m-%d
        extension .log
        ifempty
        create

        firstaction
        today=$(date +"%Y-%m-%d")
        filename="/var/log/mmdvm/MMDVM_Bridge-$today.log"
        if [ -f "$filename" ]; then
                mv /var/log/mmdvm/MMDVM_Bridge-$today.log /var/log/mmdvm/MMDVM_Bridge.log
        fi
        endscript
}
put a empty MMDVM_Bridge.log in /var/log/MMDVM. (touch /var/log/mmdvm/MMDVM_Bridge.log)

Steve N4IRS


On 8/22/20 2:45 PM, Tom wrote:
I'm trying to use logrotate to keep the /var/log/mmdvm directory clean. I can not specify a simple log filename because each day the filename (before.log) changes with the date embedded. This occurs with MMDVM_Bridge, P25Gateway, and P25Reflector logs. Since these names are generated outside of logrotate, they are all treated as different logs. Is there a way to not include the date in the log file?
Tom / K5TRA