Skip to content

Systemd journal mapping#4995

Open
bachp wants to merge 2 commits intoopen-telemetry:mainfrom
bachp:systemd-journal-mapping
Open

Systemd journal mapping#4995
bachp wants to merge 2 commits intoopen-telemetry:mainfrom
bachp:systemd-journal-mapping

Conversation

@bachp
Copy link
Copy Markdown
Contributor

@bachp bachp commented Mar 26, 2026

Changes

Add example how to map Journald fields to OpenTelemetry to the Log Data Model Appendix.

  • Related issues #
  • Related OTEP(s) #
  • Links to the prototypes (when adding or changing features)
  • CHANGELOG.md file updated for non-trivial changes
    • For trivial changes, include [chore] in the PR title to skip the changelog check
  • Spec compliance matrix updated if necessary

@bachp bachp requested review from a team as code owners March 26, 2026 14:53
@linux-foundation-easycla
Copy link
Copy Markdown

linux-foundation-easycla Bot commented Mar 26, 2026

CLA Signed

The committers listed above are authorized under a signed CLA.


| Field | Type | Description | Maps to Unified Model Field |
| ----- | ---- | ----------- | --------------------------- |
| `_SOURCE_REALTIME_TIMESTAMP` | uint64 | The earliest trusted timestamp of the message, if known, as CLOCK_REALTIME in microseconds since the Unix epoch. Optional. | Timestamp |
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since the PR description is sparse and there's no corresponding issue, I'd like to know a bit more about this. Specifically, whether this mapping is embodied in any code / component like the collector's journaldreceiver?

cc journald receiver code owners @belimawr, @namco1992

Copy link
Copy Markdown
Contributor Author

@bachp bachp Mar 31, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry I should have added some context

Currently this mapping is not implemented in any open source project, as far as I know.
I have a custom lua script that does it for fluent-bit which I would like toconvert to a C written processor and submit to fluentbit.

This PR is intended to come to define what a mapping from jorunald should look like before submitting code.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bachp https://github.com/open-telemetry/opentelemetry-collector-contrib/tree/main/receiver/journaldreceiver implements journald to Otel mapping. We cannot have the mapping description here to be different than what journaldreceiver implements. The implementation in Otel Collector should match what Otel spec says.

There are 2 possible ways forward:

  • We document here what journaldreceiver implements.
  • We adjust journaldreceiver implementation to match what is documented here.

Copy link
Copy Markdown
Contributor Author

@bachp bachp Apr 1, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I looked at the implenetation in journaldreceiver. And as far as I understand it doesn't do any mapping except for __REALTIME_TIMESTAMP -> Timestamp.

All oder fields are just put into a Map inside the Body.

e.g.

LogRecord #2                                                                                                                                                                                                                                                                                                                                                                           
     ObservedTimestamp: 2026-04-01 09:01:45.855525618 +0000 UTC                                                                                                                                                                                                                                                                                     Modified Files                          
     Timestamp: 2026-04-01 09:01:45.710521 +0000 UTC                                                                                                                                                                                                                                                                                                specification/logs/data-model-a +1 -2   
     SeverityText:                                                                                                                                                                                                                                                                                                                                                                          
     SeverityNumber: Unspecified(0)                                                                                                                                                                                                                                                                                                                                                         
     Body: Map({                                                                                                                                                                                                                                                                                                                                                                            
       "MESSAGE":"OpenTelemetry journald demo test message",                                                                                                                                                                                                                                                                                                                                
       "PRIORITY":"6",                                                                                                                                                                                                                                                                                                                                                                      
       "SYSLOG_FACILITY":"1",                                                                                                                                                                                                                                                                                                                                                               
       "SYSLOG_IDENTIFIER":"pascal",                                                                                                                                                                                                                                                                                                                                                        
       "SYSLOG_TIMESTAMP":"Apr  1 11:01:45 ",                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                
       "_HOSTNAME":"hostname",                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            
       [...]                                                                                                                                                                                                                                                                                                                                   
     })                                                                                                                                                                                                                                                                                                                                                                                     

So based on this I update the recommendatio with the following:

  • Don't map ObservedTimestamp
  • Align the TimeStamp source with the implementation using __REALTIME_TIMESTAMP as fallback

The other extended mapping would then need to be implemented in journaldreceiver once agreed. But this would be a breaking change there.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bachp take a look at open-telemetry/opentelemetry-collector-contrib#46500 there is already an effort to map more fields to attributes consistent with otel.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My advise is to speak with journaldreceiver codeowners to understand why they only did timestamp mapping and whether they are open to implementing mapping for additional fields that you are proposing in this PR.

Copy link
Copy Markdown
Contributor Author

@bachp bachp Apr 16, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The proposal is now aligned with open-telemetry/opentelemetry-collector-contrib#46500

Only exception is the mapping of _COMM as discussed in open-telemetry/opentelemetry-collector-contrib#46500 (comment)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bachp
Copy link
Copy Markdown
Contributor Author

bachp commented Apr 7, 2026

Related discussion open-telemetry/opentelemetry-collector-contrib#7298

@bachp bachp force-pushed the systemd-journal-mapping branch from f35464d to 58b181f Compare April 15, 2026 07:16
Comment thread specification/logs/data-model-appendix.md
Copy link
Copy Markdown
Member

@tigrannajaryan tigrannajaryan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

6 participants