-1

The configuration of my rsyslog file in logrotate :

/opt/mapvariable/log/myapp
{
        rotate 24
        hourly
        maxsize 10k
        compress
        ifempty
        postrotate
        reload rsyslog >/dev/null 2>&1 || true
        endscript
}

I have copied logrotate from cron.daily to cron.hourly.

Then I executed following commands :

sudo logrotate -f /etc/logrotate.conf

sudo logrotate -f /etc/logrotate.conf

Still, it's not working. Any guidance will be much helpful.

Thank You.

ams
  • 315
  • 4
  • 17
  • @jww This is related to a development work. The logfile I am creating is of a newly developed app. So as per the development requirements, I need to rotate the log file. You can see the logfile name and location are different from the generic name and location. I know that at stackoverflow we can post only development and programming related questions. So, next be careful of what you are commenting and doing. – ams Jul 14 '17 at 11:42

1 Answers1

0

Define logs in first line like:

/opt/mapvariable/log/mapapp/*.log
{
    ...
}

It will run this on all files end with .log or give the log file name instead of .log. Comment the post-rotate section to troubleshoot. Rotation of logs required for empty files too with ifempty? Check the size of logs file too.

jww
  • 97,681
  • 90
  • 411
  • 885
Amit Bondwal
  • 133
  • 1
  • 2
  • 12