Publisher

The Publisher subsystem is a pluggable interface for outbound messages, structured following the OpenConfig / IETF YANG models. The messages can be published over a variety of services – see Available publishers and their options. From the command line, the Publisher module can be selected using the --publisher option, e.g.:

$ napalm-logs --publisher kafka

From the configuration file, the Publisher can be specified using the publisher option, eventually with several options. The options depend on the nature of the Publisher.

Example: publisher configuration using the default configuration

publisher: zmq

Example: publisher configuration using custom options

publisher:
  kafka:
    topic: napalm-logs-out

Note

The IP Address / port for the Publisher be specified using the publish-address: 0.0.0.0 and publish-port: 49017 configuration options.

Multiple publishers

New in version 0.4.0.

It is possible to export the structured napalm-logs structured documents into multiple systems, over multiple channels, each with its separate configuration options. This feature is available only from the configuration file, e.g.:

publisher:
  - zmq:
      address: 1.2.3.4
      port: 5678
  - kafka:
      topic: napalm-logs-out
  - http:
      address: https://example.com/webhook

Available publishers and their options

Globally available options

Additionally, the user can configure the following options, available to all publishers:

disable_security: False

The message encryption can be disabled per publisher as well. Similar to the main disable-security configuration option, is it recommended not to disable security, though this can be needed in certain particular cases.

Configuration example:

publisher:
  - cli:
      disable_security: true
  - zmq: {}

error_whitelist: []

New in version 0.4.0.

Publish only the error messages included in this list. The whitelist/blacklist logic is implemented in such a way that if anything is added in this list, only these message types will be published and nothing else.

Default: None (empty list)

Configuration example:

publisher:
  - kafka:
      error_whitelist:
        - UNKNOWN
        - RAW
  - zmq:
      error_whitelist:
        - BGP_MD5_INCORRECT
        - BGP_NEIGHBOR_STATE_CHANGED

error_blacklist: ['RAW', 'UNKNOWN']

New in version 0.4.0.

Filter out the error types publisher. The error messages included in this list will not be published.

Default: RAW, UNKNOWN (both RAW and UNKNOWN message types will not be published by default).

Configuration example:

publisher:
  - kafka:
      error_blacklist:
        - UNKNOWN
        - RAW
        - USER_ENTER_CONFIG_MODE
  - zmq:
      error_blacklist:
        - UNKNOWN

no_encrypt: False

New in version 0.4.2.

Do not encrypt messages for this over this publisher

Configuration example:

publisher:
  - kafka:
      no_encrypt: True

only_raw: False

New in version 0.4.0.

When this option is enabled, the publisher will publish only the syslog messages that could not be parsed.

Example:

publisher:
  - zmq:
      address: 1.2.3.4
      port: 1234
  - zmq:
      address: 5.6.7.8
      port: 5678
      only_raw: true

Note

This option is a shortcut to the error_whitelist: [] configuration option introduced in 0.4.0 (codename Crowbar), by adding the RAW message to the whitelist message types, i.e.,

publisher:
  - zmq:
      address: 1.2.3.4
      port: 1234
  - zmq:
      address: 5.6.7.8
      port: 5678
      error_whitelist:
        - RAW

only_unknown: False

New in version 0.4.0.

When this option is configured, napalm-logs will publish only the structured documents that are marked as UNKNWON (i.e., napalm-logs was unable to parse the message and determine the operating system).

Example:

publisher:
  kafka:
    only_unknown: true

Note

This option is a shortcut to the error_whitelist: [] option introduced in 0.4.0 (codename Crowbar), by adding the UNKNOW message type to the whitelist, i.e.,

publisher:
  kafka:
    error_whitelist:
      - UNKNOWN

send_raw: False

If this option is set, all processed syslog messages, even ones that have not matched a configured error, will be published over the specified transport. This can be used to forward to log server for storage.

Example:

publisher:
  zmq:
    send_raw: true

Note

This option is just a shortcut to the error_blacklist: ['RAW', 'UNKNOWN'] configuration option introduced in 0.4.0 (codename Crowbar), by removing the RAW error type from the blacklisted message types, i.e.,

publisher:
  zmq:
    error_blacklist:
      - UNKNOWN

send_unknown: False

If this option is set, all processed syslog messages, even ones that have not matched a certain operating system, will be published over the specified transport. This can be used to forward to log server for storage.

Example:

publisher:
  kafka:
    send_unknown: true

Note

This option is just a shortcut to the error_blacklist: ['RAW', 'UNKNOWN'] option introduced in 0.4.0 (codename Crowbar), by removing the UNKNOWN message from the blacklist, i.e.,

publisher:
  kafka:
    error_blacklist:
      - RAW

serializer: msgpack

New in version 0.4.0.

The serializer to be used when publishing the structure napalm-logs document.

Default: MessagePack.

You can specify a separate serialize per publisher, e.g.:

publisher:
  - kafka:
      serializer: json
  - cli:
      serializer: pprint