Skip to content

feat: add a private enterprise SD-ELEMENT for the log pipeline - #63

Merged
DavidCozens merged 1 commit into
mainfrom
stage-15-pipeline-sd
Aug 16, 2026
Merged

feat: add a private enterprise SD-ELEMENT for the log pipeline#63
DavidCozens merged 1 commit into
mainfrom
stage-15-pipeline-sd

Conversation

@DavidCozens

@DavidCozens DavidCozens commented Aug 16, 2026

Copy link
Copy Markdown
Contributor

Write a private enterprise SD-ELEMENT. RFC 5424 reserves this form for definitions of your own, and
SyslogPipelineSd.c is a complete example of one: it implements the library's structured-data
extension point in its own translation unit.

static void SyslogPipelineSd_Format(struct SolidSyslogStructuredData* base, struct SolidSyslogSdElement* element)
{
    (void) base;

    SolidSyslogSdElement_Begin(element, "logPipeline", SYSLOG_ENTERPRISE_NUMBER);
    SolidSyslogSdValue_String(SolidSyslogSdElement_Param(element, "transport"), "tls");
    SolidSyslogSdValue_String(SolidSyslogSdElement_Param(element, "atRest"), "hmac-sha256");
    SolidSyslogSdElement_End(element);
}

static struct SolidSyslogStructuredData s_pipelineSd = {SyslogPipelineSd_Format};
... [logPipeline@32473 transport="tls" atRest="hmac-sha256"] device started

The vtable has one entry, Format, and the library never allocates the object. A stateless source
therefore needs no _Create and no pool slot; it is a static this application owns and points the
config at. A source with per-instance state puts that state alongside the vtable in the same struct
and reads it back from the base parameter.

A non-zero enterprise number is what produces a private SD-ID: _Begin emits name@number for one
and a bare IANA name for zero. SyslogEnterprise.h now defines the number and derives the string
that origin's enterpriseId carries, so the two forms cannot drift.

What the element reports is the state of the logging path. A collector can confirm that a record
arrived over TLS and was sealed at rest, and can alert on a device whose pipeline has weakened. The
remaining stages change both values as the protection changes.

It lives in its own file rather than in Syslog.c because it is an object implementing a library
interface rather than wiring. The figures are identical either way.

Summary by CodeRabbit

  • New Features

    • Added structured syslog metadata identifying TLS transport and HMAC-SHA256 at-rest protection.
    • Added a private logPipeline@32473 structured-data element to emitted records.
  • Documentation

    • Updated usage guidance, output examples, implementation details, and cost estimates for pipeline structured data.
  • Tests

    • Updated performance and size reports to validate the new pipeline metadata output.

@coderabbitai

coderabbitai Bot commented Aug 16, 2026

Copy link
Copy Markdown

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

Review Change Stack

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 137d5113-7d33-4be3-80ae-1861be71a3f9

📥 Commits

Reviewing files that changed from the base of the PR and between d524d64 and 78867c9.

⛔ Files ignored due to path filters (2)
  • measurements/pipeline-sd.csv is excluded by !**/*.csv
  • measurements/stages.tsv is excluded by !**/*.tsv
📒 Files selected for processing (7)
  • CMakeLists.txt
  • README.md
  • app/syslog/Syslog.c
  • app/syslog/SyslogEnterprise.h
  • app/syslog/SyslogPipelineSd.c
  • app/syslog/SyslogPipelineSd.h
  • run-report.md

📝 Walkthrough

Walkthrough

The change adds a private logPipeline@32473 structured-data provider. It reports TLS transport and HMAC-SHA256 at-rest protection, registers during syslog startup, builds in the baseline executable, and updates documentation and measurements.

Changes

Pipeline structured-data reporting

Layer / File(s) Summary
Provider contract and formatter
app/syslog/SyslogEnterprise.h, app/syslog/SyslogPipelineSd.h, app/syslog/SyslogPipelineSd.c
Defines enterprise number 32473 and adds a stateless provider that emits logPipeline@32473 with transport=tls and atRest=hmac-sha256.
Build and startup registration
CMakeLists.txt, app/syslog/Syslog.c
Builds the provider and registers it as the fourth structured-data entry during Syslog_Start.
Documentation and run validation
README.md, run-report.md
Documents the Private SD-ELEMENT stage and updates output, cost, size, and self-check measurements for pipeline-sd.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Sequence Diagram(s)

sequenceDiagram
  participant Syslog_Start
  participant SyslogPipelineSd
  participant Syslog_Record
  Syslog_Start->>SyslogPipelineSd: SyslogPipelineSd_Get()
  Syslog_Start->>Syslog_Record: register structured-data provider
  Syslog_Record->>SyslogPipelineSd: format pipeline metadata
  SyslogPipelineSd-->>Syslog_Record: logPipeline@32473 with TLS and HMAC-SHA256
Loading

Possibly related PRs

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch stage-15-pipeline-sd

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

Base automatically changed from stage-14-hmac to main August 16, 2026 17:58
@DavidCozens

Copy link
Copy Markdown
Contributor Author

@coderabbitai pause

SyslogPipelineSd implements the library's StructuredData extension point in its
own translation unit and emits logPipeline@32473, naming the transport and the
at-rest policy. It is a worked example of the one part of RFC 5424 structured
data that an integrator defines.

  Flash      +13,556 B  (+140 on the previous stage)
  RAM        +37,476 B     (+4)
  Log stack     +680 B  (unchanged)
  Service     +3,768 B  (unchanged)

Four bytes of static RAM is the whole instance. The vtable has one entry and the
library never allocates the object, so a stateless source needs no _Create and no
pool slot.

A non-zero enterprise number is what produces a private SD-ID: _Begin emits
"name@number" for one and a bare IANA "name" for 0. This stage needs the number
rather than the string, so SyslogEnterprise.h defines the number and derives the
string origin's enterpriseId carries. Adopting a registered number stays a
one-line edit.

Its own file rather than more of Syslog.c: this is an object implementing a
library interface rather than wiring, and a reader looking for how to write an SD
source should find one file that is only that. The figures are identical either
way.

A collector can use the element to confirm that a record arrived over TLS and was
sealed at rest, and to alert on a device whose pipeline has weakened.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@DavidCozens
DavidCozens force-pushed the stage-15-pipeline-sd branch from c085eef to 78867c9 Compare August 16, 2026 17:58
@DavidCozens
DavidCozens merged commit 89c7bc2 into main Aug 16, 2026
@DavidCozens
DavidCozens deleted the stage-15-pipeline-sd branch August 16, 2026 17:58
@coderabbitai

coderabbitai Bot commented Aug 16, 2026

Copy link
Copy Markdown
✅ Action performed

Reviews paused.

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