Welcome to Centmin Mod Community
Become a Member

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

    30,561
    6,851
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +10,266
    Local Time:
    3:43 AM
    Nginx 1.13.x
    MariaDB 5.5
  2. pamamolf

    pamamolf Well-Known Member

    2,767
    245
    63
    May 31, 2014
    Ratings:
    +436
    Local Time:
    7:43 PM
    Nginx-1.13.x
    MariaDB 10.1.x
    On the same path:
    there is nginx.pid file.

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

    eva2000 Administrator Staff Member

    30,561
    6,851
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +10,266
    Local Time:
    3:43 AM
    Nginx 1.13.x
    MariaDB 5.5
    yes for Centmin Mod it's proper place :)
     
    • Informative Informative x 1
  4. pamamolf

    pamamolf Well-Known Member

    2,767
    245
    63
    May 31, 2014
    Ratings:
    +436
    Local Time:
    7:43 PM
    Nginx-1.13.x
    MariaDB 10.1.x
    Ok so now is it safe to delete all .log files from:

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

    eva2000 Administrator Staff Member

    30,561
    6,851
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +10,266
    Local Time:
    3:43 AM
    Nginx 1.13.x
    MariaDB 5.5
    yup
     
  6. pamamolf

    pamamolf Well-Known Member

    2,767
    245
    63
    May 31, 2014
    Ratings:
    +436
    Local Time:
    7:43 PM
    Nginx-1.13.x
    MariaDB 10.1.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

    30,561
    6,851
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +10,266
    Local Time:
    3:43 AM
    Nginx 1.13.x
    MariaDB 5.5
    did you comment out the logs in nginx.conf ?
     
  8. pamamolf

    pamamolf Well-Known Member

    2,767
    245
    63
    May 31, 2014
    Ratings:
    +436
    Local Time:
    7:43 PM
    Nginx-1.13.x
    MariaDB 10.1.x
    Both have in front #
     
  9. pamamolf

    pamamolf Well-Known Member

    2,767
    245
    63
    May 31, 2014
    Ratings:
    +436
    Local Time:
    7:43 PM
    Nginx-1.13.x
    MariaDB 10.1.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

    30,561
    6,851
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +10,266
    Local Time:
    3:43 AM
    Nginx 1.13.x
    MariaDB 5.5
    ah access log needs to be turned off
    Code (Text):
    access_log off;
    

    error_log can't be turned off
     
  11. pamamolf

    pamamolf Well-Known Member

    2,767
    245
    63
    May 31, 2014
    Ratings:
    +436
    Local Time:
    7:43 PM
    Nginx-1.13.x
    MariaDB 10.1.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
     
    • Agree Agree x 1
  12. eva2000

    eva2000 Administrator Staff Member

    30,561
    6,851
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +10,266
    Local Time:
    3:43 AM
    Nginx 1.13.x
    MariaDB 5.5
    yeah plan to do that soon :)
     
    • Like Like x 1
  13. pamamolf

    pamamolf Well-Known Member

    2,767
    245
    63
    May 31, 2014
    Ratings:
    +436
    Local Time:
    7:43 PM
    Nginx-1.13.x
    MariaDB 10.1.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 Well-Known Member

    2,767
    245
    63
    May 31, 2014
    Ratings:
    +436
    Local Time:
    7:43 PM
    Nginx-1.13.x
    MariaDB 10.1.x
    What do you think George for that?
     
  15. eva2000

    eva2000 Administrator Staff Member

    30,561
    6,851
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +10,266
    Local Time:
    3:43 AM
    Nginx 1.13.x
    MariaDB 5.5
    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 Well-Known Member

    2,767
    245
    63
    May 31, 2014
    Ratings:
    +436
    Local Time:
    7:43 PM
    Nginx-1.13.x
    MariaDB 10.1.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!
     
    • Agree Agree x 1
  17. eva2000

    eva2000 Administrator Staff Member

    30,561
    6,851
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +10,266
    Local Time:
    3:43 AM
    Nginx 1.13.x
    MariaDB 5.5
    done :)
     
    • Like Like x 1
  18. pamamolf

    pamamolf Well-Known Member

    2,767
    245
    63
    May 31, 2014
    Ratings:
    +436
    Local Time:
    7:43 PM
    Nginx-1.13.x
    MariaDB 10.1.x
    Thank you :)
     
  19. Jimmy

    Jimmy Premium Member Premium Member

    1,138
    252
    83
    Oct 24, 2015
    East Coast USA
    Ratings:
    +609
    Local Time:
    12:43 PM
    1.13.x
    MariaDB 10.1.x
    This is something we're going to have to manually add, right?
     
  20. Jimmy

    Jimmy Premium Member Premium Member

    1,138
    252
    83
    Oct 24, 2015
    East Coast USA
    Ratings:
    +609
    Local Time:
    12:43 PM
    1.13.x
    MariaDB 10.1.x
    FYI - changing the access log to this will produce an error and an nginx restart fail.