The basic format of the message can be controlled in a number of ways. The -f option or the LOGFORMAT environment variable specify the format using the following special sequences to specify the various parts of a message. The default format is: "%P %T %N %S:%L\n%M".
The formats are described in the following table:
Format |
Description |
%P(...) |
Priority level format: %d or %s |
%T(...) |
Time level format: all options supported by date cmd. There is also an additional format, %u, which is the Unix time printed as an 8-digit hexadecimal number. |
%N |
Name of process |
%S |
Sourcefile name |
%L |
Line number |
%M(%r[={sepChr}]) |
Message text. If %r is specified, the fields of the message are not expanded, but just entered raw. If a separator character is specified, it is placed between each raw field. If it is not specified, the FS character is placed between each field and a GS character is placed after the last field, which is just the way the fields would appear in the compressed logging files. |
%C |
The entire compressed message |
%% |
% character |
\{chr} |
Standard C backslash conventions |
... |
All other characters are printed as-is |
@{synthetic-fields}@
Synthetic fields are alternate names for %P, %T, %N, %S, %L, and %M fields, but they also give access to specific fields within the %M field by name or index. The legal synthetic fields are described in the following table:
Synthetic field |
Description |
@index@ OR @id@ OR @i@ |
The absolute index of the message |
@symbol@ OR @sym@ OR @s@ |
The symbolic name of the message |
@class@ OR @c@ |
The class of the message |
@classIndex@ OR @ci@ |
The index of the message within its class |
@priority@ OR @pri@ OR @p@ |
Priority of the message in %s format |
@time@ OR @t@ |
Equivalent to %T. These may be followed by specifiers like .sec, .hour, .mon, and so on, to get a specific part of the time. |
@program@ OR @prog@ |
Equivalent to %N |
@file@ |
Equivalent to %F |
@line@ |
Equivalent to %L |
@field@[xxx] OR @f@[xxx] |
Where xxx is either a numerical index of the field or the symbolic name of the field |
@message@ OR @msg@ OR @m@ |
The fully expanded message |
@cmpmsg@ |
The original compressed message |