How to change nginx log rotation period


How can I change this and have it retained across upgrades ?

If I edit the web.template.yml in /var/discourse/templates I get a problem pulling new versions.

Stopping production log
(Alan Tan) #2

You can add the commands to change the rotation period in your container file :slight_smile:


In app.yml ?
Any pointer to where I can see what I need to change or how to do this ?

— EDIT ----
Ok - I figure that logrotate is being used, I can see /etc/logrotate.d/nginx in the container.

If I edit that file in the container won’t it get destroyed when I rebuild my container and I’ll have to redo the change ?

(Sam Saffron) #4

You run your commands AFTER we run our commands, so you can change whatever and have it persisted.


Just in case I’ve got the wrong end of the stick, I need to make my change in the container in /etc/logrotate.d/nginx ?

If so - when I rebuild the container the configuration change will be lost. It’s not persisted outside the container like configuration I specify in app.yml. I need to write and run a script of my own to maintain my configuration.

(Sam Saffron) #6

Nope, you would use an after hook never edit supplies shared templates


OK - I can hook into the rebuild process after your commands ?
How and where do I do that - apologies for not being familiar with all the ins and outs of how discourse is building the containers.

(Sam Saffron) #8


injects after:


Fantastic - I get it now :slight_smile:


Looking at web.template.yml there’s no hooks after logrotate’s configuration

Is the custom commands section of my app.yml a suitable location to put this until there’s a hook I can use ?

## Remember, this is YAML syntax - you can only have one block with a name
  - exec: echo "Beginning of custom commands"

(Sam Saffron) #11

feel free to do a PR to add a hook there if you need.