Logging Configuration

Configuration Hierarchy

The diagram illustrates the logging configuration hierarchy.

Logging Configuration Hierarchy

Configuration Syntax and Commands

The following sections describe the logging configuration syntax and commands.

BDS Logging Configuration

You can configure BDS logging for a BD, a module, and for a group.

A specific configuration takes priority over a generic configuration. For example, if you have configured a global log level of bgp.iod.1 to "warning", and you have configured a log level of bgp module to "notice", then the final log level of bgp will be "notice".

Configuring BDS Logging for a BD

BDS logging can be configured for a BD.

Syntax:

set log bd <bd-name> <option> …​

Attribute Description

<bd-name>

Configure for the specified BD name.

all

Configure for all BDs.

module <module-name>

Module name. For more information, see the section "Configuring BDS Logging for a Module".

plugin-alias alias-name <alias-name>

Plugin alias name

plugin-alias level <level>

Log severity level. You can filter logs based on the log severity levels for sending to the external log management server. This will help you to send only the required log messages to the log management server instead of sending a whole lot of data.

For example, if you configure Warning as the severity level, logs with the severity level 'Warning' and all the log levels above Warning such as Error, Critical, Alert, and Emergency will be sent to the log management server.

Example 1: BDS logging for a BD Configuration

{
  "ietf-restconf:data": {
    "rtbrick-config:system": {},
    "rtbrick-config:log": {
      "bd": [
        {
          "bd-name": "bgp.iod.1",
          "level": "info",
          "plugin-alias": {
            "alias-name": "ztp",
            "level": "error"
          }
        }
      ]
    }

Configuring BDS Logging for a Module

Logging can be configured for a module such as BGP, IS-IS, and so on.

Syntax:

set log module <module-name> <option> …​

Attribute Description

<module-name>

Module name

group <group-name>

BDS log module log-group configuration. For more information, see the section "Configuring BDS Logging for a Group".

level <level>

Log severity level.

plugin-alias alias-name <alias-name>

Plugin alias name

plugin-alias level <level>

Log level. You can filter logs based on the log severity levels for sending to the log management server. This will help you to send only the required log messages to the log management server instead of sending a whole lot of data.

For example, if you configure Warning as the severity level, logs with the severity level 'Warning' and all the log levels above Warning such as Error, Critical, Alert, and Emergency will be sent to the log management server.

Example 1: Logging Module Configuration

{
  "ietf-restconf:data": {
    "rtbrick-config:system": {},
    "rtbrick-config:log": {
      "module": [
        {
          "module-name": "igmp",
          "level": "info",
          "plugin-alias": {
            "alias-name": "graylog-srv1",
            "level": "warning"
          }
        }
      ]
    }
  }
}

Configuring BDS Logging for a Group

Logging can be configured at the group hierarchy level.

Syntax:

set log module <module-name> group <group-name> <option> …​

Attribute Description

<group-name>

Group name

level <level>

Specifies the level of the plug-in alias.

rate-limit <rate-limit>

Rate-limiting is only supported for log groups. Configuring a higher rate-limit for a whole module may cause system instability due to generation of high volume of logs. The default value is 10.

plugin-alias alias-name <alias-name>

Plugin alias name

plugin-alias level <level>

Specifies the level of the plug-in alias. You can filter logs based on the log severity levels for sending to the log management server. This will help you to send only the required log messages to the log management server instead of sending a whole lot of data.

For example, if you configure Warning as the severity level, logs with the severity level 'Warning' and all the log levels above Warning such as Error, Critical, Alert, and Emergency will be sent to the log management server.

Example 1: Logging Group Configuration

{
  "ietf-restconf:data": {
    "rtbrick-config:log": {
      "module": [
        {
          "module-name": "bgp",
          "group": [
            {
              "group-name": "interface",
              "level": "warning"
            }
          ]
        }
      ]
    }
  }
}

System Logging Configuration

LXC and ONL Logging Configuration

You can configure an external log management server to transport logs for real-time analysis. Currently, Syslog and Graylog are the log management servers supported by RBFS.

You can send logs from Linux and ONL system facilities such as auth, authpriv, daemon, and kern to the log management server.

Syntax:

set log system facility <facility-name> plugin-alias <attribute> <value>

Attribute Description

<facility-name>

Supported facilities include all, auth, authpriv, daemon, and kern.

plugin-alias alias-name <alias-name>

Plugin alias name

plugin-alias level <level>

Specifies the level of the plug-in alias. You can filter logs based on the log severity levels for sending to the log management server. This will help you to send only the required log messages to the log management server instead of sending a whole lot of data.

For example, if you configure Warning as the severity level, logs with the severity level 'Warning' and all the log levels above Warning such as Error, Critical, Alert, and Emergency will be sent to the log management server.

Example 1: System Log Configuration

{
  "ietf-restconf:data": {
    "rtbrick-config:log": {
      "system": {
        "facility": [
          {
            "facility-name": "kern",
            "plugin-alias": {
              "alias-name": "graylog",
              "level": "notice"
            }
          }
        ]
      }
    }
  }
}

CtrlD Logging Configuration

When you configure a plugin alias in RBFS, the log message is forwarded to CtrlD. CtrlD forwards it to the corresponding the log management server endpoint alias that you configured.

You must add the log management server endpoint in the CtrlD start-up configuration before configuring a plugin-alias in RBFS.

If the configured plugin-alias name does not match any of the log management server endpoint name configured in CtrlD, the log is sent to the default the log management server endpoint ("graylog_url").

For Graylog support, you need to configure logging in the CtrlD.

RBFS logs can be sent to the log management server servers. This can be achieved by configuring a plugin alias in CtrlD.

The following section describe the tasks to be performed to configure the plugin alias in CtrlD:

config.json

This section describes the main configuration file of CtrlD. This file can be changed via API. If it is changed on the file system, CtrlD has to be restarted.

/etc/rtbrick/ctrld/config.json example

{
  "graylog_enable": true,
  "graylog_url": "http://198.51.100.149:12201/gelf",
  "graylog_endpoints": [
    {
      "name": "ztp",
      "url": "http://198.51.100.146:12201/gelf"
    }
  ]
}
/etc/rtbrick/ctrld/config.json format
Name Type Description

graylog_enable

bool

To Enable all Graylog outgoing messages

graylog_url

string

Graylog url e.g. http://198.51.100.11:12201/gelf

graylog_heart_beat_interval

string

Graylog heartbeat Interval in seconds (⇐0 means deactivated)

graylog_endpoints

GraylogEndpoints allows to specify multiple graylog endpoints by name. If a log to a specific endpoint is requested and the endpoint is not available, the log is send to the default Graylog endpoint.

Name Type Description

name

string

Logical name of the entpoint e.g.: ztp for ztp messages.

url

string

Graylog url e.g. http://198.51.100.11:12201/gelf

disable

string

Disables this endpoint.

If the default endpoint is disabled, but the specific one is enabled than the message to the specific endpoint will be sent.

If the default endpoint is enabled, but the specific one is disabled than the message to the specific endpoint will not be sent.