Skip to content

[mod_logfile] Add structured channel log tags - #1

Draft
BIT-ja wants to merge 2 commits into
masterfrom
feature/mod-logfile-structured-tags
Draft

[mod_logfile] Add structured channel log tags#1
BIT-ja wants to merge 2 commits into
masterfrom
feature/mod-logfile-structured-tags

Conversation

@BIT-ja

@BIT-ja BIT-ja commented Jul 14, 2026

Copy link
Copy Markdown
Owner

Description

Adds structured per-channel context to mod_logfile output and a set_log_tag dialplan application.

set_log_tag name=value sets or replaces a channel log tag. set_log_tag name= and set_log_tag name remove it. mod_logfile can include captured tags and configured live channel variables in the prefix of each physical log line.

The implementation also handles APR short writes, partial-error writes, transient reopen failures, HUP/rotation cleanup, allocation failures with raw fallback, and UTF-8-safe value sanitation.

Existing UUID behavior remains enabled by default. log-tags and channel-vars are opt-in.

Type of Change

  • Bug fix
  • New feature
  • Breaking change
  • Documentation update
  • Code cleanup / refactor

Related Issues

Upstream PR: signalwire#3077

Testing

This PR is used to run the fork's GitHub Actions workflows against the exact upstream PR commit.

  • Added/updated unit tests
  • Tested manually
  • Tested with live SignalWire credentials (if applicable)

Checklist

  • I have read the CONTRIBUTING guidelines
  • My code follows the project's style guidelines
  • I have added tests for my changes (if applicable)
  • I have updated documentation (if applicable)
  • All existing tests pass

Additional Notes

CI preflight for signalwire#3077. The head commit is 1df022dfa5e14f12fe97740ba84d6d5a55f6186b.

BIT-ja added 2 commits July 13, 2026 10:23
Changes:
- Use single-evaluation assertions for event creation, channel tag access, and prefix configuration helpers.
- Remove the ineffective event-reclaim teardown workaround.

Bug Analysis:
- Symptom: ASAN reported leaked events allocated by switch_event_create_plain() and switch_channel_get_log_tags().
- Root cause: fst_check_int_equals evaluates its first argument twice, so side-effecting calls allocated or duplicated an event twice and overwrote the first pointer.
- Evidence: every leak stack points to a side-effecting call passed as the first argument; the teardown workaround left the leak count and stacks unchanged.
- Fix: use fst_check(call() == expected), which evaluates the call once.
- Risk: test-only assertion changes; production behavior is unchanged.

Checkout Source: upstream/master

Verification:
- git diff --check passed.
- GitHub ASAN CI reproduced the RED state and confirmed the teardown workaround was ineffective.
- Green GitHub CI pending after push.

Committer: Codex (GPT-5)
@BIT-ja
BIT-ja force-pushed the feature/mod-logfile-structured-tags branch from e5a6039 to 7455171 Compare July 14, 2026 11:33
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.

1 participant