Want more timely Centmin Mod News Updates?
Become a Member

[Solved] NGINX vhost logs

Discussion in 'Bug Reports' started by Tracy Perry, Mar 14, 2016.

  1. Tracy Perry

    Tracy Perry Active Member

    188
    80
    28
    Aug 24, 2014
    Texas
    Ratings:
    +129
    Local Time:
    10:21 AM
    1.11.5
    MariaDB 10.0.28
    Is anyone else having issues with the latest BETA not rotating the logs as expected. My vhosts have access/error logs with entries dating back to 02/2016 (when I set the new server up). Logs in the /var/log location are apparently being rotated correctly.
     
  2. Tracy Perry

    Tracy Perry Active Member

    188
    80
    28
    Aug 24, 2014
    Texas
    Ratings:
    +129
    Local Time:
    10:21 AM
    1.11.5
    MariaDB 10.0.28
    OK.. some testing shows that the normal nginx log routine has this in it
    Code:
            daily
            dateext
            missingok
            rotate 5
            size=500M
            compress
            delaycompress
            notifempty
            postrotate
    and will NOT run on my system and archive the vhost nginx logs.

    I created a new nginx_domains in the /etc/logrotate.d directory that contains
    Code:
            daily
            dateext
            missingok
            rotate 5
            compress
            delaycompress
            postrotate
    and the process runs fine. For those that don't want to do the comparison, I removed the size=500M and the notifempty parameters.
     
    Last edited: Mar 14, 2016
    • Informative Informative x 1
  3. eva2000

    eva2000 Administrator Staff Member

    28,923
    6,565
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +9,742
    Local Time:
    1:21 AM
    Nginx 1.13.x
    MariaDB 5.5
    so you logs are smaller than 500MB ?

    Which CentOS version 6.x or 7.x ? contents of
    • /etc/logrotate.d/nginx
    • /etc/logrotate.d/php-fpm
    size of the logs ? from command where yourdomain.com is changed to your vhost domain name
    Code (Text):
    ls -lAhrt /home/nginx/domains/yourdomain.com/log/
    total 0
    -rw-r--r-- 1 root root 0 Mar 11 03:26 error.log
    -rw-r--r-- 1 root root 0 Mar 11 03:26 access.log
     
  4. Tracy Perry

    Tracy Perry Active Member

    188
    80
    28
    Aug 24, 2014
    Texas
    Ratings:
    +129
    Local Time:
    10:21 AM
    1.11.5
    MariaDB 10.0.28
    Derp... makes sense... but no, they were not. I've still removed the 500M aspect as I want them to be done on a regular basis and not dependent upon file sizes (for consistent archival time periods).
     
  5. eva2000

    eva2000 Administrator Staff Member

    28,923
    6,565
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +9,742
    Local Time:
    1:21 AM
    Nginx 1.13.x
    MariaDB 5.5
    I see, well the reason why I set it up this way was to ensure no log file ever got past 500MB in a 24hr period due to Centmin Mod originally being for the LEB - lowendbox types where folks had little disk and ram available. But I think I used the wrong option. Sounds like for /etc/logrotate.d/nginx, i should change from size to maxsize. Maxsize option tells logrotate to rotate on defined time = daily, but rotate a log if it gets to 500MB size even before the end of the 24hr period (daily). Size instead gives rotate priority to the size and not the defined time.

    so change from
    Code (Text):
    size=500M

    Code (Text):
    maxsize 500M
     
    Last edited: Mar 15, 2016
    • Like Like x 1
  6. Tracy Perry

    Tracy Perry Active Member

    188
    80
    28
    Aug 24, 2014
    Texas
    Ratings:
    +129
    Local Time:
    10:21 AM
    1.11.5
    MariaDB 10.0.28
    Probably be a worthwhile change... I'm not really worried about the file size that accumulates in 1 day. For me, it's the time period that is important. I don't really care if the log is 5 meg or 5 gig. ;)
     
  7. eva2000

    eva2000 Administrator Staff Member

    28,923
    6,565
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +9,742
    Local Time:
    1:21 AM
    Nginx 1.13.x
    MariaDB 5.5
    might add a check to see how much memory and disk space a server has to determine if i set the maxsize :)
     
  8. eva2000

    eva2000 Administrator Staff Member

    28,923
    6,565
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +9,742
    Local Time:
    1:21 AM
    Nginx 1.13.x
    MariaDB 5.5
    • Winner Winner x 1