Skip to content

feat(access-log): add configurable access logging#574

Merged
stackia merged 8 commits into
mainfrom
codex/access-log
Jun 25, 2026
Merged

feat(access-log): add configurable access logging#574
stackia merged 8 commits into
mainfrom
codex/access-log

Conversation

@stackia

@stackia stackia commented Jun 24, 2026

Copy link
Copy Markdown
Owner

Summary

Adds configurable access logging for media requests, controlled by access_log and log_format in 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:clang
  • pnpm run lint:ruff
  • cmake --build build -j$(getconf _NPROCESSORS_ONLN)
  • ./scripts/run-e2e.sh test_access_log.py
  • pnpm run docs:build
  • git diff --check

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

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: 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".

Comment thread src/access_log.c Outdated

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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/.h to render nginx-style $variable access log lines and write them to a configurable file.
  • Add access_log and log_format to 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.

Comment thread src/access_log.c
Comment thread src/access_log.c Outdated

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 17 out of 17 changed files in this pull request and generated 3 comments.

Comment thread src/configuration.c
Comment thread src/configuration.c
Comment thread src/access_log.c Outdated
@stackia stackia force-pushed the codex/access-log branch from 28196de to cfd491a Compare June 25, 2026 06:15
@github-actions

Copy link
Copy Markdown
Contributor

Azure Static Web Apps: Your stage site is ready! Visit it here: https://thankful-water-0a297bf00-574.eastasia.1.azurestaticapps.net

@github-actions

Copy link
Copy Markdown
Contributor

Azure Static Web Apps: Your stage site is ready! Visit it here: https://thankful-water-0a297bf00-574.eastasia.1.azurestaticapps.net

@github-actions

Copy link
Copy Markdown
Contributor

Azure Static Web Apps: Your stage site is ready! Visit it here: https://thankful-water-0a297bf00-574.eastasia.1.azurestaticapps.net

@github-actions

Copy link
Copy Markdown
Contributor

Azure Static Web Apps: Your stage site is ready! Visit it here: https://thankful-water-0a297bf00-574.eastasia.1.azurestaticapps.net

@stackia stackia merged commit 4c39bd1 into main Jun 25, 2026
10 checks passed
@stackia stackia deleted the codex/access-log branch June 25, 2026 06:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants