RSyslog Documentation

imdocker: Docker Input Module

Module Name:imdocker
Author:Nelson Yen
Available since:8.41.0


The imdocker input plug-in provides the ability to receive container logs from Docker (engine) via the Docker Rest API.

Other features include:

  • filter containers through the plugin options
  • handle long log lines (greater than 16kb) and obtain
  • container metadata, such as container id, name, image id, labels, etc.

Note: Multiple docker instances are not supported at the time of this writing.

Configuration Parameters

The configuration parameters for this module are designed for tailoring the behavior of imdocker.


Parameter names are case-insensitive.


This module supports module parameters, only.

Module Parameters


typedefaultmandatoryobsolete legacy directive

Specifies the Docker unix socket address to use.


typedefaultmandatoryobsolete legacy directive

Specifies the version of Docker API to use. Must be in the format specified by the Docker api, e.g. similar to the default above (v1.27, v1.28, etc).


typedefaultmandatoryobsolete legacy directive

Specifies the polling interval in seconds, imdocker will poll for new containers by calling the ‘List containers’ API from the Docker engine.


typedefaultmandatoryobsolete legacy directive
string nonone

Specifies the http query component of the a ‘List Containers’ HTTP API request. See Docker API for more information about available options. Note: It is not necessary to prepend the string with ‘?’.


typedefaultmandatoryobsolete legacy directive

Specifies the http query component of the a ‘Get container logs’ HTTP API request. See Docker API for more information about available options. Note: It is not necessary to prepend the string with ‘?’.


typedefaultmandatoryobsolete legacy directive

This option specifies the whether imdocker will process newly found container logs from the beginning. The exception is for containers found on start-up. The container logs for containers that were active at imdocker start-up are controlled via ‘GetContainerLogOptions’, the ‘tail’ in particular.


typedefaultmandatoryobsolete legacy directive
integer or string (preferred)userno$InputFileFacility

The syslog facility to be assigned to log messages received. Specified as numbers.


typedefaultmandatoryobsolete legacy directive
integer or string (preferred)noticeno$InputFileSeverity

The syslog severity to be assigned to log messages received. Specified as numbers (e.g. 6 for info). Textual form is suggested. Default is notice.


typedefaultmandatoryobsolete legacy directive

This is only meaningful if multi-line messages are to be processed. LF characters embedded into syslog messages cause a lot of trouble, as most tools and even the legacy syslog TCP protocol do not expect these. If set to “on”, this option avoid this trouble by properly escaping LF characters to the 4-byte sequence “#012”. This is consistent with other rsyslog control character escaping. By default, escaping is turned on. If you turn it off, make sure you test very carefully with all associated tools. Please note that if you intend to use plain TCP syslog with embedded LF characters, you need to enable octet-counted framing. For more details, see Rainer’s blog posting on imfile LF escaping.


The imdocker module supports message metadata. It supports the following data items:

  • Id - the container id associated with the message.
  • Names - the first container associated with the message.
  • ImageID - the image id of the container associated with the message.
  • Labels - all the labels of the container associated with the message in json format.

Note: At the time of this writing, metadata is always enabled.

Statistic Counter

This plugin maintains statistics <>. The statistic is named “imdocker”.

The following properties are maintained for each listener:

  • submitted - total number of messages submitted to main queue after reading from journal for processing since startup. All records may not be submitted due to rate-limiting.
  • ratelimit.discarded - number of messages discarded due to rate-limiting within configured rate-limiting interval.
  • curl.errors - total number of curl errors.

Caveats/Known Bugs

  • At the moment, this plugin only supports a single instance of docker on a host.

Configuration Examples

Load module, with only defaults

This activates the module with all the default options:


Load module, with container filtering

This activates the module with container filtering on a label:


Example template to get container metadata

An example of how to create a template with container metadata

template (name="ImdockerFormat" type="string"
      string="program:%programname% tag:%syslogtag% id:%$!metadata!Id% name:%$!metadata!Names% imageid:%$!metadata!ImageID% labels:%$!metadata!Labels% msg: %msg%\n"

See also

Help with configuring/using Rsyslog:

  • Mailing list - best route for general questions
  • GitHub: rsyslog source project - detailed questions, reporting issues that are believed to be bugs with Rsyslog
  • Stack Exchange (View, Ask) - experimental support from rsyslog community

See also

Contributing to Rsyslog:

Copyright 2008-2020 Rainer Gerhards (Großrinderfeld), and Others.

Scroll to top