Logging Overview
RBFS logging is the process of writing log messages during the execution of an event. RBFS logging provides you reports about the events in the entire RBFS ecosystem at different functional areas. Almost every component in an RBFS access network generates a varied form of log files. Therefore, there are many different types of logs. All these logs, which are generated from different components, can be exported to the log management server where you can view and analyze the real-time data. It provides you the ability to trace out the errors of the applications in real-time.
RBFS has been designed based on microservices architecture. An RBFS ecosystem contains multiple microservices and these microservices can be divided as Brick Daemons (BD) and other (non-BD) daemons. CtrlD and ApiGwD daemons are part of ONL, but they do not reside inside of RBFS container. BDS provides in-built infrastructure for logging which can be used by all BDS applications.
You can configure logging based on different severity levels available.
This document provides you information about logging in the entire RBFS ecosystem. It includes the RBFS container and the host OS which is ONL in case of hardware switches.
Logging in RBFS Container
RBFS provides logging for the entire RBFS ecosystem that includes Brick Daemons (BD) and also for other (non-BD) daemons. Brick Daemons are built on top of BDS and other (non-BD) daemons (such as Prometheus) are the ones which are not dependent on BDS.
The RBFS container logging infrastructure provides in-memory (BDS) and traditional (BD) logging support for RBFS applications. The BDS logging is a low-latency and in-memory logging which can be used in a high scale system without compromising much in performance whereas BD logging is a direct write to a file hence CPU-heavy.
In RBFS, logs are generated from various components or sources such as BDS, Syslog, CTRLD, APIGwD, and Prometheus. All these logs can be finally exported to a log management server.
BDS Logging
BDS logs are stored in a log table. For every unique event, a log ID is created in RBFS. Whenever that particular event is logged, a log entry gets added to the log table. A log table is created for a module only when that module has at least one event logged. Every module in RBFS has at least one log table named in this format: <modulename>.<bd-name>.log
.
Log Tables
BDS logs are stored in a BDS table. BDS creates a log table for each module in a BD. One entry is added to this log table for every log. Older entries are removed from the table when the number of entries exceeds more than 10,000.
Log Maps
Every log is mapped to one specific event that is logged by the application. For the optimized usage of memory, RBFS does not store the verbose strings; instead, it stores the log map as an identifier to the actual string message.
Log map and log ID refer to the same entity. |
You can access these log maps at the following location:
/usr/share/rtbrick/liblog/logs/
You can see the log maps, organized based on the modules that they belong to, at:
supervisor@rtbrick:/usr/share/rtbrick/liblog/logs$ ls bds bgp fib fwdinfra ifm lldpv2 pd policy pubsub resmon rib snapshot static time_series
In the preceding example, you can see the modules that have registered with the log maps.
If you want to know more about a particular log map, you can perform a grep of the log map in this directory.
Log Groups
A log group is a collection of log maps or log IDs. Groups have been introduced to simplify the log configuration tasks. For example, to debug a BGP peer issue, instead of enabling logs for individual log IDs that are related to BGP peer, you can enable log for a log group BGP peer.
Log Modules
Every BDS application consists of multiple modules. Logging can be configured for each BDS modules separately.
The following are RBFS modules:
bcm_q2c bgp fib hostconfd ifm igmp ipoe isis l2tp lag ldp license lldp mrib ospf pim policy poold pppoe resmon rib rtbrick-cli secure_management snapshot subsMgmt static time_series vpp
Plugin Alias
Any logs in RBFS can be exported to an external logging destination. Currently, CtrlD supports GELF and syslog as external plugins.
CtrlD is the egress node for all the GELF (Graylog Extended Log Format) messages. The brick daemons which are configured to send GELF messages to CtrlD and CtrlD forwards them to the configured endpoints such as syslog or GELF endpoint. This is because CtrlD enhances the GELF message with switch-global settings (for example, the serial number of the switch).
Guidelines and Limitations for BDS Logging
-
By default, BDS logging is enabled and the log level is set to 'Error'.
-
By default, logging for BDS and PUBSUB modules have been disabled. As these two modules are infrastructure specific, these logs may not be useful for end-users. However, developers can enable logging for these modules using debug commands.
-
You can configure log levels per BD, per module, or per group.
-
Do not keep logging enabled for longer duration in a scaled setup.
-
The following log levels are present in the system. Any level above the level
Warning
indicates that you should perform logging with caution as a scaled environment may cause a system instability.-
Emergency
-
Alert
-
Critical
-
Error
-
Warning
-
Notice
-
Info
-
Debug
-
None
-
If your system becomes unstable, you can remove the logging configuration using the delete log command in configuration mode.
|
|
Syslog
Syslog is generated by an API based logging mechanism provided by Linux. Some of the open source libraries present in RBFS use Syslog as a logging mechanism.
Host operating system and RBFS Linux container use syslog for logging. Syslog can also be exported to Graylog.
Syslog messages can also be exported to CtrlD and these messages are forwarded to the defined log management servers. Currently, RBFS supports exporting syslog from the Linux and ONL system facilities such as auth
, authpriv
, daemon
, and kern
to Graylog
For information about Syslog configuration, see section [syslog_config].
TSDB (Prometheus) Alert Messages
Prometheus is the systems and service monitoring application, which can be deployed in RBFS, to collect and process metrics. In RBFS, alert messages generated from Prometheus are forwarded to CtrlD and these messages, from CtrlD, can be exported to the configured log management servers.
Logging in ONL
In RBFS, there are daemons, which are not part of RBFS container, but run on the ONL host. RBFS provides logging for these daemons. The following are the daemons which reside on the ONL host:
hostconfd CtrlD ApiGwD
CtrlD and ApiGwD Logs
CtrlD logging provide log messages of events related to business, elements, ZTP, and security. ApiGwD logs contain details about who accessed the API and how they accessed it. hostconfd
provides rest APIs to interact with container and ONL linux services.
ApiGwD`and `CtrlD
send different log messages about status changes or progress of processes to the configured GELF endpoint.