Confirm the version boundary before adding the function
Current Asterisk documentation lists LOG_GROUP() since 18.21.0, 20.6.0 and 21.1.0. Confirm the exact running release and that core show function LOG_GROUP exposes the function before changing a production dialplan. Online branch documentation is not proof that an older or differently packaged PBX has the same capability.
The function assigns the current channel to one group for logger filtering. It does not create a file, enable a log level, raise console verbosity or turn on a PJSIP packet trace. Keep those independent controls in the capture plan.
Assign an alphanumeric group at the earliest stable entry point
Asterisk recommends calling LOG_GROUP() as soon as possible when dialplan execution begins because an active filter can suppress or reveal subsequent CLI dialplan output. Choose a short alphanumeric operational label such as billing or ivrtest, place the assignment after the minimum routing decision needed to know the label and preserve the dialplan revision that produced it.
Do not place customer identifiers, telephone numbers, credentials, SIP URIs or free-form untrusted input in the group name. A group is a filter selector, not a business record or authentication boundary.
[support-entry]
exten => _X!,1,Set(LOG_GROUP()=support)
same => n,NoOp(Support route entered)
same => n,Goto(route-support,${EXTEN},1)Treat replacement and clearing as channel-state changes
Calling the function again replaces the channel's previous group assignment. Writing an empty value removes the existing membership. Record the channel name and the exact priority where each write occurs, because a mid-call replacement changes which later messages can pass an active group filter.
Avoid treating a group as an append-only tag list. If two operational views are required, design one deliberate label vocabulary or collect a bounded unfiltered artifact for the reproduction rather than repeatedly rewriting group state without a timeline.
Follow every channel leg explicitly
LOG_GROUP() is documented as assigning a channel. Caller, callee, Local-channel halves, queue member channels and transfer-created channels remain distinct owners unless direct evidence shows an assignment on each one. A group written on the inbound channel must not be represented as automatically covering a later outbound leg.
Correlate visible lines with channel names and Asterisk call identifiers. Call ID logging is a separate built-in correlation mechanism and can span several channels or change around transfers; it is not the LOG_GROUP() value and the group is not a SIP Call-ID.
Separate filter state from verbosity and destinations
The logger filter changroup CLI command consumes the group name, while logger filter show and reset controls describe the active filter state. Separately, core set verbose, core set debug, logger show channels, logger reload and logger rotate affect other parts of logging. Root and remote consoles can also have different verbosity.
Capture the exact console, filter state, verbosity, enabled levels and logger destinations before deciding that a missing line was never generated. A filtered CLI view is not a complete forensic record, and a file destination may contain a different set of levels or messages.
Use a bounded capture and restore the prior state
Define one reproduction window, expected channel entry, intended group, needed log levels and success criterion. Preserve pre-change filter and verbosity state, apply the narrow group selection, reproduce once, export the authorized redacted evidence and then restore or reset the temporary filter and extra verbosity.
Protocol debugging remains a separate, potentially sensitive control. A visible dialplan line does not prove a SIP request, RTP packet, endpoint result or completed call. This guide is documentation-derived; no PBX, channel, group, filter, log, packet or call was tested.
Sources & applicability
Primary references for the technical details above. Operational examples and planning checklists are VoIP.info editorial guidance.
- Asterisk LOG_GROUP dialplan function ↗
- Asterisk 22 LOG_GROUP dialplan function ↗
- Asterisk logging overview ↗
- Asterisk basic logging commands ↗
- Asterisk call identifier logging ↗
- Asterisk collecting debug information ↗
Examples require adaptation to your topology. No live PBX or hardware testing is claimed.