-
Notifications
You must be signed in to change notification settings - Fork 0
Switch to JSON format for Nginx logs #11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
maquchizi
commented
Jan 29, 2026
- This will allow us to parse logs better in Grafana
kilemensi
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
@kilemensi Codex doesn't want to cooperate. Perhaps it needs some set up for this repo? |
|
@codex review |
Yeah, https://github.com/CodeForAfrica/ghost wasn't connected @maquchizi . Should be good now. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 0cdf36cf85
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| server_name {{ .NOSSL_SERVER_NAME }}; | ||
|
|
||
| access_log /var/log/nginx/{{ .APP }}-access.log; | ||
| access_log /var/log/nginx/{{ .APP }}-access.log json; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Avoid mixed access log formats in same file
This server block now writes JSON to /var/log/nginx/{{ .APP }}-access.log, but the HTTPS server block below still writes to the same file without the json format. In deployments where HTTPS handles most traffic, the access log will therefore mix JSON and default log lines, which breaks JSON-only parsing (e.g., in Grafana) or drops entries. If the goal is to switch to JSON logs, the 443 access_log should use the same json format or a separate file.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OMG! This is actually a good catch. I forgot to change the format in the HTTPS block.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM.
What about adding upstream_response_time?
|
@codex review |
|
To use Codex here, create a Codex account and connect to github. |
@VinneyJ We can add the upstream stuff at a later point if needed. Better to have only the relevant metrics for our current use case. |