Skip to content

Conversation

@tcely
Copy link
Contributor

@tcely tcely commented Feb 11, 2025

For #70

I found hat-syslog which looks like an excellent way to handle logs from nginx and potentially anything else that uses a syslog server.

This does quick and dirty rotation of the nginx directory.

This is needed because of the earlier ownership / permissions changes not accounting for the web server user.

Also, the logs won't grow forever; which is nice.
The error log contains informational and higher levels on the theory that when something goes wrong we will want as much information as we can get about why an error occurred.

Access log is compressed, in memory, then written to disk every minute. Most people will take about that long to start reading the file anyway.
@tcely tcely marked this pull request as ready for review February 11, 2025 21:38
@meeb
Copy link
Owner

meeb commented Feb 12, 2025

Doesn't this break HTTP request logging for the container in general? As in, removes it from the standard stdout and writes it to disk? Also unless I've missed it this doesn't have any log rotation by default?

@tcely
Copy link
Contributor Author

tcely commented Feb 12, 2025

Doesn't this break HTTP request logging for the container in general? As in, removes it from the standard stdout and writes it to disk?

Removing the access log from stdout was the intention here. I wouldn't call that broken.

Also unless I've missed it this doesn't have any log rotation by default?

The rotation is happening before starting nginx, so if you leave it running for long enough you could have lots of logs in a single file. However, access logs compress extremely well.

@tcely
Copy link
Contributor Author

tcely commented Mar 13, 2025

@meeb The merge conflict has been resolved.

@meeb
Copy link
Owner

meeb commented Mar 13, 2025

Thanks. I'm on the fence with this one, your patch is fine, it's a philosophical difference. I prefer containers to write their logs, all of them, to stdout. I don't think the web server gets enough traffic for this "spam" to be significant. Is there a core reason to divert some of the logs to disk and potentially bypassing general container log analysis tools?

@tcely
Copy link
Contributor Author

tcely commented Mar 13, 2025

I personally almost never care about the web access logs. They are annoying and in the way when I want to follow what is happening.

A wishlist item might be to have a way to send logs from the web server through the common logger and provide a way to turn displaying them on/off while everything is running. That would solve both of our use cases.

@tcely tcely marked this pull request as draft June 18, 2025 13:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Ready

Development

Successfully merging this pull request may close these issues.

2 participants