0

I need to read the access log from nginx, do some post processing and send it as a csv to another server. But by default nginx generates access log in one single file. Is there any way to create the access log files every x minute? for example x=10 minute

access.log.2022-01-31-08-10.log
access.log.2022-01-31-08-20.log
access.log.2022-01-31-08-30.log

Help will be appreciated. Thanks!

1 Answers1

1

Your operating system has a specific utility for log rotation. In Linux it is logrotate.

You need to configure it to rotate logs at the frequency you want.

Beware that too frequent log rotation might have performance effects, especially if you let the log files stay in the same directory.

Tero Kilkanen
  • 36,796
  • 3
  • 41
  • 63