Welcome to Centmin Mod Community
Register Now

Beta Branch disable unneeded access_log and error_log directives in nginx.conf

Discussion in 'Centmin Mod Github Commits' started by eva2000, Sep 8, 2017.

  1. eva2000

    eva2000 Administrator Staff Member

    53,142
    12,110
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,645
    Local Time:
    7:23 PM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
  2. pamamolf

    pamamolf Premium Member Premium Member

    4,068
    427
    83
    May 31, 2014
    Ratings:
    +832
    Local Time:
    12:23 PM
    Nginx-1.25.x
    MariaDB 10.3.x
    On the same path:
    there is nginx.pid file.

    Is that the proper place for it? :)
     
  3. eva2000

    eva2000 Administrator Staff Member

    53,142
    12,110
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,645
    Local Time:
    7:23 PM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
    yes for Centmin Mod it's proper place :)
     
  4. pamamolf

    pamamolf Premium Member Premium Member

    4,068
    427
    83
    May 31, 2014
    Ratings:
    +832
    Local Time:
    12:23 PM
    Nginx-1.25.x
    MariaDB 10.3.x
    Ok so now is it safe to delete all .log files from:

    Code:
    /usr/local/nginx/logs/
    ?
     
  5. eva2000

    eva2000 Administrator Staff Member

    53,142
    12,110
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,645
    Local Time:
    7:23 PM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
    yup
     
  6. pamamolf

    pamamolf Premium Member Premium Member

    4,068
    427
    83
    May 31, 2014
    Ratings:
    +832
    Local Time:
    12:23 PM
    Nginx-1.25.x
    MariaDB 10.3.x
    After restarting Nginx it is auto creating that files access.log and error.log on that path .....

    It's not a problem but you may need to remove that function :)
     
  7. eva2000

    eva2000 Administrator Staff Member

    53,142
    12,110
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,645
    Local Time:
    7:23 PM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
    did you comment out the logs in nginx.conf ?
     
  8. pamamolf

    pamamolf Premium Member Premium Member

    4,068
    427
    83
    May 31, 2014
    Ratings:
    +832
    Local Time:
    12:23 PM
    Nginx-1.25.x
    MariaDB 10.3.x
    Both have in front #
     
  9. pamamolf

    pamamolf Premium Member Premium Member

    4,068
    427
    83
    May 31, 2014
    Ratings:
    +832
    Local Time:
    12:23 PM
    Nginx-1.25.x
    MariaDB 10.3.x
    I just notice that even with the logs commented:
    Code:
    #access_log  logs/access.log combined buffer=128k flush=5m;
    #error_log   logs/error.log warn;
    at
    Code:
    /usr/local/nginx/conf/nginx.conf
    After restart they are auto recreated and not only that also logs entries coming there :(
     
  10. eva2000

    eva2000 Administrator Staff Member

    53,142
    12,110
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,645
    Local Time:
    7:23 PM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
    ah access log needs to be turned off
    Code (Text):
    access_log off;
    

    error_log can't be turned off
     
  11. pamamolf

    pamamolf Premium Member Premium Member

    4,068
    427
    83
    May 31, 2014
    Ratings:
    +832
    Local Time:
    12:23 PM
    Nginx-1.25.x
    MariaDB 10.3.x
    Then it will be better to change that edit from:

    Code:
    #access_log  logs/access.log combined buffer=128k flush=5m;
    #error_log   logs/error.log warn;
    to

    Code:
    access_log  logs/access.log off;
    error_log   logs/error.log warn;
    So we will get the access log off and the error log that we can't disable to log only warn messages :)

    Thank you
     
  12. eva2000

    eva2000 Administrator Staff Member

    53,142
    12,110
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,645
    Local Time:
    7:23 PM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
    yeah plan to do that soon :)
     
  13. pamamolf

    pamamolf Premium Member Premium Member

    4,068
    427
    83
    May 31, 2014
    Ratings:
    +832
    Local Time:
    12:23 PM
    Nginx-1.25.x
    MariaDB 10.3.x
    Great thank you :)

    For the error log i think we can use:

    Code:
    error_log /dev/null crit;
    or maybe is better to use it like?

    Code:
    error_log stderr crit;
    as the redirect to /dev/null does not work reliably since from version 0.7.53 /var/log/nginx/error.log is hardcoded to be used until the config file has been read....

    Using /dev/null on systems where /var/log/nginx/* doesn't exist will cause nginx to quit.
     
    Last edited: Sep 10, 2017
  14. pamamolf

    pamamolf Premium Member Premium Member

    4,068
    427
    83
    May 31, 2014
    Ratings:
    +832
    Local Time:
    12:23 PM
    Nginx-1.25.x
    MariaDB 10.3.x
    What do you think George for that?
     
  15. eva2000

    eva2000 Administrator Staff Member

    53,142
    12,110
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,645
    Local Time:
    7:23 PM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
    honestly wouldn't worry about it warn would be enough seeing as what it was set to all these years and fail2ban doesn't check them anyway
     
  16. pamamolf

    pamamolf Premium Member Premium Member

    4,068
    427
    83
    May 31, 2014
    Ratings:
    +832
    Local Time:
    12:23 PM
    Nginx-1.25.x
    MariaDB 10.3.x
    Ok thanks :)

    But I think you must revert that fix from commenting the two lines to setting the access log to off; and what ever you like for the error log ...

    So existing or new installations will have that...

    Thank you!
     
  17. eva2000

    eva2000 Administrator Staff Member

    53,142
    12,110
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,645
    Local Time:
    7:23 PM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
    done :)
     
  18. pamamolf

    pamamolf Premium Member Premium Member

    4,068
    427
    83
    May 31, 2014
    Ratings:
    +832
    Local Time:
    12:23 PM
    Nginx-1.25.x
    MariaDB 10.3.x
    Thank you :)
     
  19. Jimmy

    Jimmy Well-Known Member

    1,778
    388
    83
    Oct 24, 2015
    East Coast USA
    Ratings:
    +987
    Local Time:
    5:23 AM
    This is something we're going to have to manually add, right?
     
  20. Jimmy

    Jimmy Well-Known Member

    1,778
    388
    83
    Oct 24, 2015
    East Coast USA
    Ratings:
    +987
    Local Time:
    5:23 AM
    FYI - changing the access log to this will produce an error and an nginx restart fail.