-1

Below are the challenges. Requesting your help on this.

  1. Files are not removing
  2. .gz files are not generated as per the user and group details given in the script.
  3. When I execute every time date extension is keep on adding to the same .gz files.
/var/log/httpd/access_log*        
/var/log/httpd/error_log*       
{      
    copytruncate
    daily      
    rotate 2
    compress
    missingok
    dateext
    maxage 5
    create 0644 hhh hhh
}   
jww
  • 97,681
  • 90
  • 411
  • 885
Venkatesh K
  • 145
  • 2
  • 5

1 Answers1

0
/var/log/httpd/access_log*    
/var/log/httpd/error_log*

Your wildcards are incorrect and catching literally everything in that directory, including the previously rotated files. The way you've defined it, logrotate is seeing the previously rotated files and treating them as new log files to start new rotations on, rather than old rotations of a previously-rotated log file. You need to tighten up your wildcards to something like this:

/var/log/httpd/*log
parttimeturtle
  • 1,125
  • 7
  • 22
  • Hi, thanks for your response. I think the problem is not with wildcards but with order of the parameters in the logrotate script. Below script is working fine after changing the order. /var/log/httpd/access_log { size 1k daily copytruncate rotate 4 compress missingok maxage 10 } – Venkatesh K Jul 13 '19 at 14:52
  • @VenkateshK The wildcard was absolutely the issue here. You've removed it from the code in your subsequent comment. Change that filepath back to `/var/log/httpd/access_log*` and I guarantee you'll have the exact same issue once again. – parttimeturtle Jul 15 '19 at 17:43