# imdiag: Diagnostic instrumentation

Module Name:

  imdiag

Author:

  Rainer Gerhards

Available since:

  at least 5.x

## Purpose

The imdiag input module exposes a TCP-based diagnostics and control channel that can inject messages into the main queue, wait for queues to drain, coordinate statistics reporting, and exercise other helper functions used by the rsyslog testbench. While imdiag is primarily intended for automated testing, it can also be used to diagnose production systems. Because the interface permits queue control and message injection, it must only be exposed to trusted hosts.

## Configuration Parameters

Note

Parameter names are case-insensitive; camelCase is recommended for readability.

### Module Parameters

Parameter | Summary
--- | ---
AbortTimeout | Starts a watchdog thread that aborts rsyslog if it runs longer than the configured time limit.
InjectDelayMode | Sets the flow-control classification applied to messages injected by imdiag.
MaxSessions | Limits the number of concurrent diagnostic control connections accepted.

### Input Parameters

Parameter | Summary
--- | ---
ListenPortFileName | Writes the port chosen for the diagnostic listener to the named file.
ServerRun | Creates the imdiag TCP listener on the specified port (`0` selects an ephemeral port).
ServerStreamDriverMode | Accepts a numeric stream driver mode value, but imdiag forces the plain TCP driver so the setting is ignored.
ServerStreamDriverAuthMode | Accepts a stream driver authentication mode string, but imdiag always uses the plain TCP driver so the value has no effect.
ServerStreamDriverPermittedPeer | Accepts permitted peer identifiers for compatibility, but the plain TCP driver used by imdiag does not enforce them.
ServerInputName | Overrides the `inputname` property for the diagnostic TCP listener’s own log messages.

## Examples

### Minimal configuration for testbench integration

This example loads `imdiag`, starts the diagnostic listener on an ephemeral port, and records the chosen port for the testbench to read.

    module(load="imdiag")
    input(type="imdiag"
          listenPortFileName="/var/run/rsyslog/imdiag.port"
          serverRun="0")

Support: rsyslog Assistant | GitHub Discussions | GitHub Issues: rsyslog source project

Contributing: Source & docs: rsyslog source project

© 2008–2025 Rainer Gerhards and others. Licensed under the Apache License 2.0.