3.111. <AcctLog FILE>

This clause logs accounting requests to a flat file. You can define as many <AcctLog FILE> clauses as you wish at the top level or within Realm or Handler clauses. Each clause can specify different logging conditions and a different log file.
<AcctLog FILE> supports all the common AcctLog configuration parameters. For more information about the AcctLog configuration parameters, see Section 3.109. <AcctLog xxxxxx>.

3.111.1. LogFormat

This string defines the format for success messages. You can use any special characters. For more information, see Section 3.3. Special formatters. The bind variables are replaced as follows:
  • %0: the result
  • %1: the reason string, usually this is empty if successful
  • %2: the tracing identifier string
The default value is:
LogFormat %l:%n:%{Acct-Session-Id}:%{Framed-IP-Address}:%{Calling-Station-Id}

3.111.2. OutputFormat

This optional string parameter defines the format for the log messages. Format specifiers, such as %{GlobalVar:name}, are evaluated when the configuration is loaded. Currently supported values are text and json. Default value is text.
Tip
For the best JSON encoding performance, check your Perl installation includes Cpanel::JSON::XS or JSON::XS.
For extensive customisation of JSON and other formats, see LogFormatHook and Radius::LogFormat module.
# We have switched from LogFormatHook to OutputFormat
#LogFormatHook sub { Radius::LogFormat::format_acctlog_json(@_); }
OutputFormat json

3.111.3. AcctLogOutputDef

This optional parameter allows you to change the way Radiator formats accounting log JSON output by mapping RADIUS attributes to JSON fields. Multi-valued RADIUS attributes are added as a JSON array. When this parameter is not defined, all RADIUS attributes are encoded. The general format is:
AcctLogOutputDef jsonattributename[,radiusattributename]
If radiusattributename is omitted, jsonattributename is used as RADIUS attribute name. Special variables, such as %n, can also be used in radiusattributename. Note that in this case % must be the first character in the radiusattributename.
For extensive customisation of JSON and other formats, see LogFormatHook and Radius::LogFormat module. For a configuration sample, see goodies/logformat.cfg file in the Radiator distribution.
# Use JSON and define what we want in the JSON output
OutputFormat json

# Use RADIUS attribute as JSON field name
AcctLogOutputDef Connect-Info

# Map attribute to JSON field
AcctLogOutputDef Custom-Event-Timestamp, Event-Timestamp

# Use special variables
AcctLogOutputDef Custom-Original-Username, %u
AcctLogOutputDef Custom-User-Name, %n

3.111.4. Filename

This optional parameter specifies the name of the file where the accounting log messages are written. You can use any special characters. For more information, see Section 3.3. Special formatters. The default value is %L/accounting.log.