Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Optionally emit __CURSOR for journald source #18881

Closed
sproberts92 opened this issue Oct 19, 2023 · 3 comments
Closed

Optionally emit __CURSOR for journald source #18881

sproberts92 opened this issue Oct 19, 2023 · 3 comments
Labels
source: journald Anything `journald` source related type: feature A value-adding code addition that introduce new functionality.

Comments

@sproberts92
Copy link
Contributor

A note for the community

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Use Cases

Some platforms with older versions of systemd do not have __SEQNUM or __SEQNUM_ID, and so events do not contain sufficient uniqueness to derive an id for indexing (without resorting to hashing the message or similar, which doesn't let you work backwards to locate the original event at the source).

Attempted Solutions

No response

Proposal

The __CURSOR field does actually contain the __SEQNUM and __SEQNUM_ID, even on systems that don't have those fields, so it would be good to be able to optionally emit the cursor with the event.

So I propose that we add a boolean option emit_cursor to enable sending __CURSOR with the event for use on older platforms, instead of stripping it out as currently occurs.

References

No response

Version

No response

@sproberts92 sproberts92 added the type: feature A value-adding code addition that introduce new functionality. label Oct 19, 2023
@neuronull neuronull added the source: journald Anything `journald` source related label Oct 19, 2023
@tobz
Copy link
Contributor

tobz commented Oct 20, 2023

@sproberts92 Are you able to link to anything that shows the chronology of the introduction of __SEQNUM, __SEQNUM_ID, and __CURSOR? Doing a cursory search didn't really turn anything up, and it would lend weight towards the idea of making a change for compatibility purposes if we could demonstrate for a fact it would increase compatibility.

@sproberts92
Copy link
Contributor Author

Chronology as in when were __SEQNUM and __SEQNUM_ID introduced? They were only added to the json journal output (which Vector consumes) in February this year, which made it into systemd v254.

Really only Arch has v254 at the moment, so this change is making deriving a unique index possible on almost all platforms where it wasn't before. And even on v254 it's still useful, from sd_journal_get_cursor:

The string only contains printable characters and can be passed around in text form. The cursor identifies a journal entry globally and in a stable way

Probably nicer to use that instead of needing to construct your own id from _SEQNUM + _BOOT_ID + etc.

@dsmith3197
Copy link
Contributor

This work was completed in #18882

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
source: journald Anything `journald` source related type: feature A value-adding code addition that introduce new functionality.
Projects
None yet
Development

No branches or pull requests

4 participants