Page MenuHomeDevCentral

Rotate nginx logs on FreeBSD servers
Open, HighPublic

Description

We've currently 19 670 214 lines of log in web-001, since February 2025 rm -rf when disk was full with MediaWiki debug information (see D3709 to stabilize this configuration).

Organize a rotation of the log with newsyslog could be useful here:

/etc/newsyslog.conf.d/nginx.conf
/var/log/www/*/*.log   root:web   640   90     *     @T00   JC  /var/run/nginx.pid 30

Configuration can be put here: roles/webserver-alkane/nginx/config.sls
Content path: roles/webserver-alkane/nginx/files/newsyslog/nginx.conf


nginx needs to be notified

nginx doesn't use new files after rotation without a reload, syslog can handle that by sending SIGHUP to the pid in the specified pid file.

See https://serverfault.com/questions/1031715/nginx-service-rotate-doesnt-use-new-log-files for example.

According https://nginx.org/en/docs/control.html, SIGHUP is fine and SIGUSR1 would be ideal, in that case write "SIGUSR1" or "30" as parameter

(people sometimes wonder why we still use pid file, that's an example of how it's used across the system)


GDPR documentation

Tagging also privacy as we can document in our GDPR practices we don't keep server logs more than the retention time.

Perhaps add an entry to https://agora.nasqueron.org/Privacy/Records_of_processing_activities#P-002._Web_applications for the server logs?

There is no policy change.

Event Timeline

dereckson triaged this task as High priority.Sep 21 2025, 15:02
dereckson created this task.
dereckson updated the task description. (Show Details)
dereckson added a subscriber: sandrined.

@sandrined Could you publish the commit for this change for review?

Configuration is ready.

Next steps:

  • Deploy to WindRiver
  • Validate after one day rotation works on WindRiver
  • Deploy to web-001 (@sandrined + @dereckson)
  • Deploy to hervil (perhaps with @DorianWinty)
  • Records of Processing for web logs (@dereckson)
  • Operations grimoire documentation about logs (@sandrined)