3.25. <Log FILE>

This optional clause creates a FILE logger, which logs all messages with a priority level of Trace or more to a file. The logging is in addition to any logging to the file defined by global LogFile. For more information, see Section 3.7.13. LogFile. The log file is opened, written, and closed for each message, which means you can rotate it at any time.
The logger becomes active when it is encountered in the configuration file. It logs parse errors from later in the configuration file and subsequent run-time events. Parse errors from earlier in the configuration file are not logged through this clause.
Logging to STDOUT by specifying Filename as a single dash - is no longer supported in Radiator 4.18.
Global LogFile and Trace configuration parameters are basically the same as the following:
<Log FILE>
      #Trace 0
      Filename filename
You can place <Log xxxxxx> clause inside any clause in the configuration file. This causes messages originating from within that clauses code to be logged with the logger prior to being logged with any global loggers. This can be handy for debugging or tracing only certain Handler or AuthBy clauses:
      # This logs messages from within the Handler
      <Log FILE>
            Trace 4
            Filename xxxxxx

3.25.1. Filename

This specifies the name of the log file. The file name can include special characters. For more information, see Section 3.3. Special formatters. The default value is %L/logfile, a file named logfile in LogDir. For more information, see Section 3.7.12. LogDir. Special character %0 is replaced by the priority integer and %1 by the log message.
Here is an example of using Filename:
# Log file goes in /var/log, with year number
Filename /var/log/%Y-radius.log
If Filename starts with a vertical bar character |, the rest of the filename is assumed to be a program to which the output is to be piped. Otherwise the output is appended to the named file.
# Pipe to my-log-prog
Filename |/usr/local/bin/my-log-prog

3.25.2. Trace

This parameter defines the priority level of messages to be traced. For more information, see Section 3.7.3. Trace.
Packet dumps appear only if the global Trace level is set to 4 or more.

3.25.3. LogMicroseconds

This optional parameter makes <Log FILE> to log the current microseconds at the end of the time string.

3.25.4. LogTraceId

LogTraceId flag parameter allows logging messages related to an authentication exchange and to its subsequent accounting session with a tracing identifier. LogTraceId can be configured for global level and Log clause level. LogTraceId enables prepending a tracing ID to messages logged to STDOUT, when LogStdout is enabled, and to log file configured with <Log FILE> and <Log SYSLOG>. For more information, see Section 3.7.2. LogStdout.
Support for using the same tracing identifier with accounting messages requires enabling parameter in the authenticating Handler clause. For more information, see Section 3.31.38. AutoClass.
Tracing ID works in conjunction with the Radiator load balancer allowing coordinated log message indexing and lookup between frontend load balancers and backend workers.
# Prepend tracing id to log messages

3.25.5. Identifier

This optional parameter acts as a label that can be useful for custom code in hooks. It can also be referred to by Log xxxxxx in any other clause.
Here is an example of using Identifier:
<AuthBy whatever>
      # With an Identifier, can refer to this logger from other clauses
      <Log FILE>
            Identifier mylogger
            Filename xxxxxx
<AuthBy whatever>
      # This AuthBy will log to the Log FILE above
      Log mylogger

3.25.6. IgnorePacketTrace

This parameter excludes this logger from PacketTrace debugging. For more information, see Section 3.14.15. PacketTrace.

3.25.7. LogFormat

This optional parameter permits you to customise the log string when LogFormatHook is not defined. Special formatting characters are permitted. The variables are replaced as follows:
  • %0 by the message severity as an integer
  • %1 by the severity as a string
  • %2 by the log message
  • %3 by tracing identifier string
When using <Log FILE>, there is no default value for LogFormat and the format is similar to LogFormat %l:%1:%2.
When using <Log SYSLOG>, there is no default value for LogFormat and the format is similar to LogFormat %2.

3.25.8. LogFormatHook

This specifies an optional Perl hook that runs for each log message when defined. By default, no hook is defined and LogFormat or the default format is used. The hook must return a single value. If the value is defined, it is used as the message to log. An undefined value causes the Log clause to return without logging. This allows LogFormatHook to function as a filter to suppress unwanted log messages.
The hook parameters are the following:
  • Message severity (integer)
  • Log message
  • Reference to the current request
  • Tracing identifier (string)
See goodies/logformat.cfg for a sample configuration file with JSON and CEF (ArcSight Common Event Format) formats.
Consider installing Cpanel::JSON::XS or JSON::XS for higher performance JSON encoding.