feat(access-log): add configurable access logging#574
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 1387f3a43e
ℹ️ 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".
There was a problem hiding this comment.
Pull request overview
Adds configurable access logging for media requests (written when a stream is registered for status tracking), including configurable access_log path and log_format placeholders. The change integrates with config files, CLI flags, OpenWrt init/LuCI UI, and ensures workers close/reopen the log FD on reload to support logrotate workflows.
Changes:
- Introduce
src/access_log.c/.hto render nginx-style$variableaccess log lines and write them to a configurable file. - Add
access_logandlog_formatto configuration parsing/snapshotting and expose them via CLI and OpenWrt/LuCI. - Reopen/cleanup access log resources on worker reload and worker shutdown; add e2e coverage and documentation updates.
Reviewed changes
Copilot reviewed 17 out of 17 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| src/worker.c | Reopen access log on SIGHUP-driven reload. |
| src/supervisor.c | Ensure worker cleanup closes access log FD on exit. |
| src/connection.c | Emit one access log line when a media request is registered in status tracking. |
| src/configuration.h | Add config fields and default access log format macro. |
| src/configuration.c | Parse access_log/log_format, add CLI flags, snapshot/free config strings. |
| src/access_log.h | Public access log API for worker/connection integration. |
| src/access_log.c | Implement access log formatting, escaping, file handling, and writing. |
| rtp2httpd.conf | Document new config keys in the sample config. |
| openwrt-support/rtp2httpd/files/rtp2httpd.init | Wire UCI options into daemon CLI args. |
| openwrt-support/rtp2httpd/files/rtp2httpd.conf | Add example UCI options for access log settings. |
| openwrt-support/luci-app-rtp2httpd/po/zh_Hans/rtp2httpd.po | Add Chinese translations for new LuCI fields/help text. |
| openwrt-support/luci-app-rtp2httpd/po/templates/rtp2httpd.pot | Add new translatable strings for access log UI. |
| openwrt-support/luci-app-rtp2httpd/htdocs/luci-static/resources/view/rtp2httpd.js | Add LuCI form inputs + validation for access log path/format. |
| e2e/test_access_log.py | Add end-to-end coverage for access logging behavior and formatting. |
| docs/reference/configuration.md | Document new options, placeholders, and logrotate guidance (ZH source). |
| docs/en/reference/configuration.md | Update EN translation to match new access log docs. |
| CMakeLists.txt | Build and link the new access_log module. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
28196de to
cfd491a
Compare
|
Azure Static Web Apps: Your stage site is ready! Visit it here: https://thankful-water-0a297bf00-574.eastasia.1.azurestaticapps.net |
|
Azure Static Web Apps: Your stage site is ready! Visit it here: https://thankful-water-0a297bf00-574.eastasia.1.azurestaticapps.net |
|
Azure Static Web Apps: Your stage site is ready! Visit it here: https://thankful-water-0a297bf00-574.eastasia.1.azurestaticapps.net |
|
Azure Static Web Apps: Your stage site is ready! Visit it here: https://thankful-water-0a297bf00-574.eastasia.1.azurestaticapps.net |
Summary
Adds configurable access logging for media requests, controlled by
access_logandlog_formatin config files, CLI args, and OpenWrt/LuCI.The implementation writes one access log line when a media request is registered for status tracking, supports nginx-style placeholders focused on status-page-visible request data, and reopens the access log on worker reload so logrotate can signal the supervisor with
SIGHUP.Validation
pnpm run lint:clangpnpm run lint:ruffcmake --build build -j$(getconf _NPROCESSORS_ONLN)./scripts/run-e2e.sh test_access_log.pypnpm run docs:buildgit diff --check