Skip to content

feat: fill in the RFC 5424 header fields - #5

Merged
DavidCozens merged 1 commit into
mainfrom
stage-05-header-fields
Aug 16, 2026
Merged

feat: fill in the RFC 5424 header fields#5
DavidCozens merged 1 commit into
mainfrom
stage-05-header-fields

Conversation

@DavidCozens

Copy link
Copy Markdown
Contributor

The record so far carries no timestamp and no device name. Fill the RFC 5424 header fields from
what the device already has: the clock it acquired at boot, the address on its interface, and its
own name.

struct SolidSyslogConfig config = {
    /* ... */
    .Clock       = SyslogFields_Clock,
    .GetHostname = SyslogFields_Hostname,
    .GetAppName  = SyslogFields_AppName,
};
<134>1 2026-08-16T19:17:54.430000Z 10.0.2.15 solid-syslog-example - BOOT - device started

PROCID stays nil, because a bare-metal image has no process to identify, and so does
STRUCTURED-DATA until the next stage.

Two things the adapters have to get right. The timestamp struct is zeroed before it is filled, so a
clock that cannot answer leaves Month == 0, fails the library's validation, and is emitted as the
nil value rather than as a wrong time. And the hostname is read under the lwIP core lock, with
ip4addr_ntoa_r rather than ip4addr_ntoa — the latter shares one static buffer across callers.

Where a device has no resolvable name, RFC 5424 section 6.2.4 allows its address in the HOSTNAME
field instead, which is this device exactly.

When you need it. As soon as more than one device reports to the collector, or a record's time
will be relied on. Everything the later stages add — a sequence number, the clock's quality, the
device's own identity — builds on these fields rather than replacing them.

@DavidCozens

Copy link
Copy Markdown
Contributor Author

@coderabbitai pause

@coderabbitai

coderabbitai Bot commented Aug 16, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 91c69fa7-57f7-4cb8-841b-e0b96b7e7318

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

Note

Reviews paused

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

Comment @coderabbitai help to get the list of available commands.

@coderabbitai

coderabbitai Bot commented Aug 16, 2026

Copy link
Copy Markdown
✅ Action performed

Reviews paused.

TIMESTAMP, HOSTNAME and APP-NAME come from what the device already has — the
wall clock it acquired at boot, the address on its interface, and its own name.
PROCID stays nil, because a bare-metal image has no process to identify.

  <134>1 2026-08-16T19:17:54.430000Z 10.0.2.15 solid-syslog-example - BOOT - device started

  Flash  +5,108 B  (+384 on the previous stage)
  RAM    +1,908 B  (unchanged)

384 bytes is what a record that says when it happened and which device it came
from costs over one that says neither. That is the difference between a log line
and evidence, and it is worth knowing the price of separately.

Two things the adapters have to get right. The timestamp struct is zeroed before
use, so a clock that cannot answer leaves Month == 0, fails the library's
validation, and is emitted as the nil value rather than as a wrong time. And the
hostname is read under the lwIP core lock, with ip4addr_ntoa_r rather than
ip4addr_ntoa — the latter shares one static buffer across callers.

RFC 5424 section 6.2.4 allows an address where a device has no resolvable name,
which is this device exactly.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@DavidCozens
DavidCozens force-pushed the stage-05-header-fields branch from 8dc0e61 to 4ed519b Compare August 16, 2026 21:47
@DavidCozens
DavidCozens changed the base branch from stage-04-udp to main August 16, 2026 21:47
@DavidCozens
DavidCozens merged commit ad9b39b into main Aug 16, 2026
1 check passed
@DavidCozens
DavidCozens deleted the stage-05-header-fields branch August 16, 2026 21:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant