Set Up Log Rolling - NGINX Agent

Log rolling is a logging strategy that limits the size of the output log file. When the log file is filled, the agent will create a new log file. Further logging will write to this new file.

Enable Log Rolling

The NGINX agent does not use log rolling by default. To enable log rolling, do the following:

  1. Run the following chown commands:
1
chmod u+rwx /etc/nginx/logs
2
chown nginx /etc/nginx/logs
  1. Set the log_destination config file property to file.

The log file size limit can be configured with the LOG_FILE_MAX_SIZE_MB configuration option.

For more information, see Log Rolling.

Permissions

To enable log rolling in NGINX, you must verify permissions on the configured log directory. The Linux user that your application server runs as should be able to read and write to this directory.

If you are using the Ubuntu or Debian installs of NGINX, the user will be named www-data. Additionally, if you are using a custom configuration, this name may be customized as well.