For AI agents: this documentation is indexed for you in llms.txt, and all of it in /llms.txt. Every page is also available as markdown: append .md to its address.

You are reading Session Management Controller 3.15, an older release. The newest release is 3.17. Go to 3.17

Structured logging

SMC event reporting and logging borrows and extends the Problem Details structure defined in RFC 7807Opens in a new tab and RFC 9457Opens in a new tab.

Event details are defined in YAML files, translated to Erlang source code, and compiled into the final release. You can modify some per-event settings through the configuration and an HTTP API. The HTTP API supports the reading of specific or all event definitions.

A custom formatter is included in SMC. Do not modify the provided formatter configuration without assistance.

Event definition

Events are defined by the developers in YAML files and translated into Erlang source code. It is not possible to add events at runtime.

At a minimum, events have cause, title, detail, and documentation fields. There are several optional fields; the most notable are $id and logging. The translator adds a unique $id UUID and type URI to all events that don't have one and generates v5 UUIDs based on the type URI. The optional logging field defaults to:

yaml

The title, detail, and documentation fields are intended to be used for human-readable documentation. The title and detail fields are also included in the application/problem+json responses on HTTP API that are derived from these events.

Log rate limitation

Some high-level log messages may be important enough to be included in the logs, using the usual Erlang logger mechanisms, but may appear very often if their cause affects many user sessions at once. Log rate limitation allows these messages to be present while simultaneously avoiding the saturation of the log stream.

Events can have an optional field named rateLimit which specifies the maximum number of messages of this event per second to be logged. To enforce the rate, a logger filter using the provided function ev_logger_filters:rate_limit/2 must be placed into the logger handler configuration. See the following example:

erlang

Note

Logger filters are applied late in the logging pipeline. The rate-limiting filter cannot be used as a log load regulation or log overload protection.

Logging events

SMC uses domain logging, as described in the Erlang documentationOpens in a new tab. Events are internally handed as reports to the Erlang loggerOpens in a new tab with the domain metadata set to [event, Group], where the value of Group is one of:

  • core for events from the SMC core engine
  • session for events related to session handling
  • gtp for GTP-related events
  • diameter for Diameter-related events
  • radius for RADIUS-related events
  • upf for UPG management and PFCP events
  • pcc for policy and charging events
  • proxy for proxy functionality events
  • unspecified for miscellaneous events

Note

The Erlang default logger configuration silently discards all log messages with a log domain set. SMC provides a custom logger configuration that enables the event log domain and all subdomains beneath it.

Additionally, the Group value can be used with the existing per-module logging facilities as described below.

ev_logger_formatter formats the events into logfmt messages. You can adjust the fields included in the message through the template configuration field.

Here is an example of the final output:

text

Logger formatter

SMC includes a custom ev_logger_formatter formatter module. Event metadata can be included in a template, similar to the logger_formatterOpens in a new tab.

Some metadata values are added by the Erlang logger and others by SMC. Most of the fields added by default are only interesting for the developers. However, keeping them in normal logging helps with post-mortem log analysis.

Erlang logger metadata fields:

SMC-added metadata is subject to availability.

Special procedures for operations

Per-group logging

The event domain group, as described in the Logging events section above, is used as a pseudo-module for module-level loggingOpens in a new tab purposes. For example, the following level enables all session-related event logs:

erlang