imbeats: Beats v2 input module¶
imbeats receives Elastic Beats and Elastic Agent output.logstash events via
Lumberjack protocol v2 over TCP or TLS, keeps the original JSON payload in
msg, maps decoded event fields into the top-level structured tree $!,
and stores transport/protocol metadata under $!metadata!imbeats.
Module Name: |
imbeats |
Author: |
Adiscon and contributors |
Available since: |
8.2604.0 |
Purpose¶
imbeats accepts Elastic Beats and Elastic Agent traffic that uses the
Logstash-style Lumberjack v2 protocol. Configure Beats or Elastic Agent with
output.logstash and point it at the rsyslog listener. The module reuses
rsyslog’s netstrm transport subsystem, so it can listen via plain TCP or
the configured TLS stream driver.
The first implementation supports:
Lumberjack v2 only
Wwindow framesJJSON event framesCcompressed framesAacknowledgements carrying the last sequence number of each window
The first implementation intentionally optimizes the internal event shape for common Elasticsearch-oriented pipelines:
msgkeeps the original JSON payloaddecoded Beat event fields are added under top-level
$!transport and protocol metadata is stored under
$!metadata!imbeatslistener-side size limits reject oversized windows, frames, batches, and compressed payload expansion before unbounded allocation
instance-wide accounting bounds memory held by incomplete sessions, inflate scratch space, event copies, and window descriptors
idle, absolute frame, and absolute window deadlines release sessions that stop making progress or retain incomplete protocol state for too long
listener-side session limits and worker settings bound concurrent sender fan-in and provide fairness between active sessions
Only $!metadata!imbeats is owned by the module. A metadata member sent
by the client is otherwise preserved: if it is a JSON object, its members other
than imbeats stay available below $!metadata, and a metadata.imbeats
member sent by the client is always overwritten by the module metadata. If the
top-level metadata member is not a JSON object (for example a string,
number, array, boolean, or null), it is replaced by an empty object in
$! so that the module metadata can be attached, and the event is accepted
and acknowledged as usual. The original value remains visible in msg and
rawmsg.
This default may be revisited later. A user-selectable representation mode is not part of the initial release.
End-to-end Elastic Agent setup¶
Install rsyslog, imbeats, and a TLS stream-driver package through your
operating system packages. On Debian or Ubuntu systems using packages that
ship the GnuTLS stream driver separately, a typical TLS prerequisite is:
sudo apt install rsyslog rsyslog-gnutls
If your distribution packages imbeats.so separately, install that package
as well. The exact package name depends on the distribution.
The example below listens on the common Beats/Logstash port 5044 and uses
GnuTLS. Replace the certificate paths with files issued for your rsyslog
receiver host.
module(load="imbeats")
input(type="imbeats"
port="5044"
ruleset="beats_to_file"
streamdriver.name="gtls"
streamdriver.mode="1"
streamdriver.authmode="anon"
streamdriver.cafile="/etc/rsyslog.d/tls/ca.pem"
streamdriver.certfile="/etc/rsyslog.d/tls/server-cert.pem"
streamdriver.keyfile="/etc/rsyslog.d/tls/server-key.pem")
ruleset(name="beats_to_file") {
action(type="omfile" file="/var/log/imbeats.log")
}
Configure Elastic Agent or Filebeat to use the Logstash output and point it at the rsyslog host:
outputs:
default:
type: logstash
hosts: ["rsyslog.example.net:5044"]
compression_level: 9
ssl.enabled: true
ssl.certificate_authorities:
- /etc/elastic-agent/certs/ca.pem
For Filebeat standalone configuration, the same output settings are placed
under output.logstash:
output.logstash:
hosts: ["rsyslog.example.net:5044"]
compression_level: 9
ssl.enabled: true
ssl.certificate_authorities:
- /etc/filebeat/certs/ca.pem
Use certificate verification in production. Test-only settings such as
ssl.verification_mode: none are useful for isolated lab checks but should
not be used for production ingestion.
The example above lets Elastic Agent or Filebeat validate the rsyslog server certificate without requiring the sender to present a client certificate. For mutual TLS, also configure the sender with its own client certificate and key, then switch the rsyslog listener to the appropriate certificate-validation auth mode and permitted peer settings.
Troubleshooting Elastic Agent delivery¶
If rsyslog reports that
gtlsorosslcannot be loaded, install the matching TLS stream-driver package, such asrsyslog-gnutlsorrsyslog-openssl.If the Beat or Agent logs certificate validation errors, confirm that the sender trusts the CA that issued the rsyslog listener certificate and that the configured host name matches the certificate.
If the sender connects but does not deliver events, verify that it is using
output.logstashand not an Elasticsearch or HTTP output.imbeatsaccepts compressed Lumberjack v2 frames. Keep compression enabled on the sender unless you are isolating a transport problem.Use the
events.received,events.submitted,compressed_frames, andprotocol_errorscounters to distinguish traffic, parsing, and protocol failures.
Protocol validation and acknowledgements¶
Each Lumberjack J frame payload must contain exactly one complete JSON
object. Leading and trailing JSON whitespace is accepted. Malformed JSON,
arrays, scalar values, concatenated values, and any trailing non-whitespace
bytes are rejected. The original accepted JSON text remains available in
msg, while the decoded object fields are mapped into $!.
Malformed frames, resource-limit violations, decompression-limit violations,
and session, frame, or window timeouts fail closed. imbeats closes the affected
session, releases its charged resources, and does not acknowledge the
incomplete batch.
Lumberjack v2 sequence numbers are scoped to a window. Beats and Elastic Agent
number the events of every window 1 to n, and imbeats accepts that
numbering on every window of a connection. For compatibility with senders that
continue the numbering across windows, a window may instead start at the
sequence number following the last acknowledged one. In both cases the
sequence numbers inside a window must increase by exactly one per event. A
window with any other numbering, for example a gap, a duplicate, or an
out-of-order event, is a protocol error: the session is closed and no event of
that window is submitted or acknowledged.
Once a complete window has been validated and all of its events have been
submitted, imbeats sends one A frame carrying the sequence number of
the last event of that window. For Beats clients this equals the number of
events in the window. $!metadata!imbeats!sequence always contains the
sequence number as sent on the wire.
When a session is closed for a reason other than a normal close by the peer or
rsyslog shutdown, imbeats logs one message that names the peer address and
port, the local port, the reason, and the rsyslog error code. The input name is
part of the message only when the input’s name parameter is set; inputs
without name are identified by the local port alone.
Typical reasons are an invalid frame type, a sequence number mismatch, a window
or frame that exceeds the configured limits, a rejected compressed frame, an
event that cannot be submitted, and idleTimeout, frameTimeout, or
windowTimeout expiry. The message never contains payload bytes.
To keep a misbehaving or reconnecting peer from flooding the log, these
messages and the too many sessions message are rate limited per input and
reason class: at most one message is logged every 10 seconds, and the next
message reports how many similar messages were suppressed. The statistic
counters described below are not rate limited.
Configuration Parameters¶
Module Parameters¶
Currently none.
Input Parameters¶
Parameter |
Summary |
|---|---|
Bind the imbeats listener to a specific local address instead of all interfaces. |
|
Set an absolute deadline for completing an in-progress Lumberjack frame read. |
|
Override the GnuTLS priority string used by the selected TLS stream driver. |
|
Close an imbeats session when it makes no byte progress for the configured time. |
|
Enable socket-level TCP keepalive on accepted imbeats connections. |
|
Set the interval between TCP keepalive probes for imbeats sessions. |
|
Set how many TCP keepalive probes are sent before the peer is considered dead. |
|
Set the idle time before TCP keepalive probing begins on imbeats sessions. |
|
Write the actual bound port to a file after an imbeats listener starts. |
|
Limit how many simultaneous Beats client sessions an imbeats listener accepts. |
|
Limit the cumulative JSON payload bytes accepted in one Lumberjack batch. |
|
Limit how many output bytes a Lumberjack compressed frame may produce per input byte. |
|
Limit how large a compressed Lumberjack frame may become after decompression. |
|
Limit the JSON or compressed frame payload size imbeats accepts from one Lumberjack frame. |
|
Limit the memory charged to incomplete Lumberjack input across an imbeats instance. |
|
Limit how many events imbeats accepts in one Lumberjack batch window. |
|
Set the |
|
Open imbeats listener sockets inside the specified Linux network namespace. |
|
Restrict accepted TLS peers to the configured certificate names. |
|
Set the TCP port on which the imbeats listener accepts Lumberjack v2 clients. |
|
Bind the imbeats input to a specific ruleset instead of the default ruleset. |
|
Limit consecutive reads from one imbeats session before other sessions can run. |
|
Set the TLS authentication mode used by the configured imbeats stream driver. |
|
Specify the CA bundle used to validate TLS peers for imbeats. |
|
Specify the local certificate presented by TLS-enabled imbeats listeners. |
|
Enable extended key usage checks when validating imbeats TLS certificates. |
|
Specify the certificate revocation list file used by TLS-enabled imbeats listeners. |
|
Specify the private key file used by TLS-enabled imbeats listeners. |
|
Select whether imbeats uses plain TCP or a TLS-enabled stream driver mode. |
|
Select the netstrm backend used by imbeats, for example |
|
Control how the imbeats TLS stream driver handles expired peer certificates. |
|
Prefer subject alternative names over common names when validating imbeats TLS peer names. |
|
Enable TLS revocation checking for certificates presented to the imbeats listener. |
|
Set the maximum certificate chain depth accepted during imbeats TLS validation. |
|
Set how many worker threads an imbeats listener uses to process client sessions. |
|
Set an absolute deadline for completing an advertised Lumberjack event window. |
Examples¶
RainerScript¶
module(load="imbeats")
input(type="imbeats"
port="5044"
ruleset="beats_to_es"
maxInFlightBytes="268435456"
maxCompressionRatio="256"
idleTimeout="60"
frameTimeout="30"
windowTimeout="300"
streamdriver.name="gtls"
streamdriver.mode="1"
streamdriver.authmode="anon"
streamdriver.cafile="/etc/rsyslog.d/ca.pem"
streamdriver.certfile="/etc/rsyslog.d/server-cert.pem"
streamdriver.keyfile="/etc/rsyslog.d/server-key.pem")
ruleset(name="beats_to_es") {
action(type="omfile" file="/var/log/imbeats-debug.log")
}
YAML¶
version: 2
modules:
- load: imbeats
inputs:
- type: imbeats
port: "5044"
ruleset: beats_to_es
maxInFlightBytes: 268435456
maxCompressionRatio: 256
idleTimeout: 60
frameTimeout: 30
windowTimeout: 300
streamdriver.name: gtls
streamdriver.mode: 1
streamdriver.authmode: anon
streamdriver.cafile: /etc/rsyslog.d/ca.pem
streamdriver.certfile: /etc/rsyslog.d/server-cert.pem
streamdriver.keyfile: /etc/rsyslog.d/server-key.pem
rulesets:
- name: beats_to_es
script: |
action(type="omfile" file="/var/log/imbeats-debug.log")
Statistic Counters¶
The module exposes these impstats counters:
connections.acceptedconnections.closedprotocol_errorsbatches.receivedbatches.ackedevents.receivedevents.submittedevents.failedcompressed_framesjson_decode_failuresack_failureswindows.rejectedframes.rejectedcompressed.rejectedconnections.activeconnections.rejectedstarvation_protectresource_bytes(current bytes charged to the instance resource budget)resource_rejectedsessions.timed_out
Support: rsyslog Assistant | GitHub Discussions | GitHub Issues: rsyslog source project
Contributing: Source & docs: rsyslog source project
© 2008–2026 Rainer Gerhards and others. Licensed under the Apache License 2.0.