#2173·DnsServer

LogExporterApp: Syslog target double-wraps messages in RFC5424 (message is fully RFC5424-formatted twice)

Author: jusicgnCreated Sep 22, 2026Updated Sep 28, 2026

Component: Apps/LogExporterApp, SyslogExportStrategy.cs Version: LogExporterApp 3.0.1

Summary

When the Syslog target of the Log Exporter app is enabled, every exported message is formatted as a complete RFC5424 syslog message twice. The _msg payload that ends up on the wire contains a full, nested RFC5424 syslog message (with its own header and structured data) inside the outer syslog message body.

Root cause

In SyslogExportStrategy.ExportAsync():

csharp
public Task ExportAsync(IReadOnlyList<LogEntry> logs)
{
    foreach (LogEntry log in logs)
        _sender.Information(_formatter.FormatMessage((LogEvent?)Convert(log)));

    return Task.CompletedTask;
}

Convert(log) builds a LogEvent with the query fields as structured properties and a message template. This LogEvent is then rendered manually via Rfc5424Formatter.FormatMessage(...) into a complete, already-finished RFC5424 string (own PRI, timestamp, hostname, app-name, proc-id, and [meta ...] structured data).

That finished string is then passed as plain text to _sender.Information(...). _sender is itself a Serilog syslog sink (UdpSyslog / TcpSyslog / LocalSyslog) configured with SyslogFormat.RFC5424, which formats the message as RFC5424 again — wrapping the already-formatted inner message inside a second, outer RFC5424 envelope.

Actual behavior

Received syslog message (example, IPs/domains anonymized):

<182>1 2026-01-01T12:00:00.000000+00:00 dns-host TechnitiumDNSServer 1234 - [meta timestamp="2026-01-01T12:00:00.000Z" clientIp="203.0.113.10" protocol="Udp" responseType="Recursive" responseRtt="12.3" rCode="NoError" qName="example.com" qType="A" qClass="IN" questionsSummary="QNAME: example.com, QTYPE: A, QCLASS: IN" aName_0="example.com" aType_0="A" aClass_0="IN" aTtl_0="60" aRData_0="203.0.113.20" aDnssecStatus_0="Unknown" answersSummary="203.0.113.20"] "QNAME: example.com, QTYPE: A, QCLASS: IN"; RCODE: "NoError"; ANSWER: ["203.0.113.20"]

Everything from <182>1 2026-01-01T... onward is itself a fully formed RFC5424 message, sitting inside the MSG part of the outer one. Any log receiver that parses standard RFC5424 (e.g. rsyslog, VictoriaLogs) only sees the outer envelope and gets the entire inner message as one opaque text blob — the [meta ...] fields are not exposed as structured data to the receiver, only recoverable by re-parsing the message body manually.

Expected behavior

A single, correctly formed RFC5424 message per query, with the query metadata exposed as top-level structured data (SD-ID) — not double syslog-wrapped.

Suggested fix

Don't pre-render the LogEvent with Rfc5424Formatter before handing it to the sink. Instead, either:

  • pass the message template and properties directly to _sender.Information(...) and let the already-configured SyslogFormat.RFC5424 sink do the formatting once, or
  • if the [meta ...] structured-data block is specifically wanted, configure the sink's own formatter/structured-data support instead of building it manually via Rfc5424Formatter beforehand.

Happy to test a fix against our setup (two DNS Server 15.5 instances, Linux, TCP syslog target) if useful.

Source: TechnitiumSoftware/DnsServer