пятница, 11 ноября 2022 г.

Linux logrotate jira logs

 Jira has its own log rotate

However, it doesn't delete old files.

It can be done with crontab though.

#### remove old jira log files longer 180 days

30 2 * * * /usr/bin/find /opt/atlassian/servicedesk/logs/ -maxdepth 1 -type f -mtime +180 -exec rm -rf {} \;

45 2 * * * /usr/bin/find /opt/atlassian/servicedesk/logs/ -maxdepth 1 -type f -mtime +6 -exec gzip -q {} \;



суббота, 26 февраля 2022 г.

Linux logrotate twice per day

Before:

/etc/logrotate.d/logs

/mnt/shared/project/var/log/*.log 

{
  su www-project www-data
  rotate 30
  daily
  missingok
  compress
  notifempty
  copytruncate
  dateext

}

After:

1) create a separate additional logrotate conf file /etc/logrotate.d/logs_erp with content below (increased twice rotate 30 -> 60 and plus delaycompress):

/etc/logrotate.d/logs_erp
/mnt/shared/project/var/log/erp.log 
{
  su www-project www-data
  rotate 60
  daily
  missingok
  compress
  delaycompress
  notifempty
  copytruncate
  dateext
}
2) modify current logrotate conf file /etc/logrotate.d/logs with excluding first 'erp' characters from wildcard:
/mnt/shared/project/var/log/[!e][!r][!p]*.log 
{
  su www-project www-data
  rotate 30
  daily
  missingok
  compress
  notifempty
  copytruncate
  dateext
}
3) run logrotate conf file /etc/logrotate.d/logs_erp by cron additionally at 18.25
under root account
25 18 * * * logrotate -f /etc/logrotate.d/logs_erp

понедельник, 3 января 2022 г.