microsoft / omi

Open Management Infrastructure
Other
360 stars 114 forks source link

Use of wildcards in logrotate causing duplication errors to be thrown #748

Closed emichellecarter closed 8 months ago

emichellecarter commented 10 months ago

When dsc is installed on the same instance as omi, the logrotate throws duplication errors due to the use of wildcards in the logrotate.conf file.

omi:2 duplicate log entry for /var/opt/omi/log/dscdetailed.log found error in file omi, skipping

/etc/opt/omi/conf/omilogrotate.conf

/var/opt/omi/log/*.log /var/opt/omi/log/*.trc 
{
    # keep 5 worth of backlogs
    rotate 5

    # If the log file is missing, go on to the next one
    # without issuing an error message.
    missingok

    # Do not rotate the log if it is empty,
    # this overrides the ifempty option.
    notifempty

    # Old versions of log files are compressed with gzip by default.
    compress

    # Log files are rotated only if they grow bigger then 100M.
    size 100M

    # Truncate the original log file in place after creating a copy,
    # instead of moving the old log file and optionally creating a new one.
    copytruncate
}

/opt/microsoft/dsc/etc/logrotate.conf

/var/opt/omi/log/*.log {
    rotate 5
    sharedscripts
    weekly
    compress
    postrotate
        /opt/omi/bin/service_control restart
    endscript
}
/var/opt/omi/log/dscdetailed.log {
    rotate 5
    sharedscripts
    size 50M
    compress
}
JumpingYang001 commented 10 months ago

@mcarter106 I think you should file it for dsc team or dsc repo.

JumpingYang001 commented 8 months ago

@mcarter106 DSC got deprecated this September.

JumpingYang001 commented 8 months ago

@mcarter106 BTW, are you using omsagent or dsc?