Skip to content

Systemd journal mapping#4995

Open
bachp wants to merge 3 commits into
open-telemetry:mainfrom
bachp:systemd-journal-mapping
Open

Systemd journal mapping#4995
bachp wants to merge 3 commits into
open-telemetry:mainfrom
bachp:systemd-journal-mapping

Conversation

@bachp

@bachp bachp commented Mar 26, 2026

Copy link
Copy Markdown
Contributor

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

linux-foundation-easycla Bot commented Mar 26, 2026

Copy link
Copy Markdown

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

@bachp bachp Mar 31, 2026

Copy link
Copy Markdown
Contributor Author

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.

@bachp bachp Apr 1, 2026

Copy link
Copy Markdown
Contributor Author

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.

@bachp bachp Apr 16, 2026

Copy link
Copy Markdown
Contributor Author

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.

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.

The journaldreceiver PR (open-telemetry/opentelemetry-collector-contrib#46500) looks good. In terms of ordering, I would rather merge this PR first as it is a sort of extension of the spec and then the implementation, given that both are aligned.

However this is not a strong option.

@bachp

bachp commented Apr 7, 2026

Copy link
Copy Markdown
Contributor Author

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

@tigrannajaryan tigrannajaryan left a 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.

Comment thread specification/logs/data-model-appendix.md
@bachp bachp force-pushed the systemd-journal-mapping branch from 58b181f to 5a2e298 Compare May 4, 2026 11:09
<td>string</td>
<td>Not well defined. May be used as a meta field for protocol operation purposes or may be part of event source identity.</td>
<td>`Attributes["syslog.procid"]`</td>
<td>`Attributes["syslog.pid"]`</td>

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@belimawr @thompson-tomo I update the syslog section to reflect the new field naming for syslog.procid => syslog.pid and syslog.msgid => syslog.msg.id as discussed in open-telemetry/opentelemetry-collector-contrib#46500 (comment) and open-telemetry/opentelemetry-collector-contrib#46500 (comment)

Comment thread specification/logs/data-model-appendix.md
@bachp bachp requested review from belimawr and thompson-tomo May 4, 2026 11:13
@github-actions

Copy link
Copy Markdown

This PR was marked stale. It will be closed in 14 days without additional activity.

@github-actions github-actions Bot added the Stale label May 19, 2026
@bachp

bachp commented May 19, 2026

Copy link
Copy Markdown
Contributor Author

This PR was marked stale. It will be closed in 14 days without additional activity.

Its still active, waiting for feedback

@github-actions github-actions Bot removed the Stale label May 20, 2026
@bachp bachp requested a review from tigrannajaryan May 21, 2026 06:12
@github-actions

github-actions Bot commented Jun 5, 2026

Copy link
Copy Markdown

This PR was marked stale. It will be closed in 14 days without additional activity.

@github-actions github-actions Bot added the Stale label Jun 5, 2026
@bachp

bachp commented Jun 5, 2026

Copy link
Copy Markdown
Contributor Author

Still waiting for feedback

@github-actions github-actions Bot removed the Stale label Jun 6, 2026
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.

7 participants