Enabling external log processing
General configuration of the external log processing is done in
ncs.conf
. Global and per device settings
controlling the external log processing for NED trace logs is
stored in CDB.
To enable external log processing set
/ncs-config/logs/external
to true
and
/ncs-config/logs/command
to the full path of the
command that will receive the log data. The same executable will
be used for all log types. External configuration example:
To support debugging of the external log command behavior a
separate log file is used. This debugging log is configured
under /ncs-config/logs/ext-log
. The example below
shows configuration for ./logs/external.log
with the highest log level set:
By default NED trace output is written to file preserving backwards
compatibility. To write NED trace logs to file for all but the
device test
which will use external log processing the following
configuration can be entered in the CLI:
When setting both external
and file
bits without setting /ncs-config/logs/external
to
true
a warning message will be logged to
ext-log
. When only setting the
external
bit no logging will be done.
Processing logs using an external command
After enabling external log processing, NSO will start one
instance of the external command for each configured log
destination. Processing of the log data is done by reading from
standard input and processing it as required.
The command line arguments provide information about the log
that is being processed and in what format the data is sent.
The example below show how the configured command
./log_processor
would be executed for
NETCONF trace data configured to log in raw
mode:
Command line argument position and meaning:
-
version. Protocol version, always set
to 1. Added for forwards compatibility.
-
action. Action being performed,
always set to log. Added for forwards
compatibility.
-
name. Name of the log being
processed.
-
log-type. Type of log data being
processed. For all but NETCONF and NED trace logs this is
set to system. Depending on the type
of NED one of ned-trace-java,
ned-trace-netconf and
ned-trace-snmp is used. NETCONF trace
is set to netconf-trace.
-
log-mode. Format of log data being
sent. For all but NETCONF and NED trace logs this will be
raw. NETCONF and NED trace logs can
be pretty printed and then format will be
pretty.