# ServerRun

Creates the imdiag TCP listener on the specified port (`0` selects an ephemeral port).

This parameter applies to imdiag: Diagnostic instrumentation.

Name:

  ServerRun

Scope:

  input

Type:

  integer (port)

Default:

  input=none

Required?:

  yes

Introduced:

  at least 5.x, possibly earlier

## Description

Starts the diagnostic control listener. The value is the TCP port number to bind. Specify `0` to request an ephemeral port from the operating system. The chosen port is recorded in the file specified by the mandatory ListenPortFileName parameter.

imdiag always uses the plain TCP (`ptcp`) network stream driver. As a result, parameters that normally tune stream driver authentication or permitted peers are accepted for compatibility but have no effect in current releases. This includes:

- ServerStreamDriverMode

- ServerStreamDriverAuthMode

- ServerStreamDriverPermittedPeer

imdiag supports only a single listener. Attempting to configure `ServerRun` more than once logs an error and the additional configuration is ignored. Set module-level parameters such as MaxSessions before invoking `ServerRun`.

## Input usage

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

### Legacy names (for reference)

Historic names/directives for compatibility. Do not use in new configs.

- $IMDiagServerRun — maps to ServerRun (status: legacy)

## See also

See also imdiag: Diagnostic instrumentation.

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.