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

journal: ability to set flags for journal instance #444

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

taranovegor
Copy link

I needed to merge journals, which involves using the --merge flag when calling journalctl. Since I couldn't find a way to do this in the current implementation, I propose the following solution.

The structure JournalReaderConfig is augmented with a field Flags that contains an array of constants. If the Flags array is not empty, the method NewJournalWithFlags is called with the bitwise OR of the values in the array.

sdjournal.NewJournalReader(sdjournal.JournalReaderConfig{
    Since: time.Duration(-1) * time.Minute,
    Flags: []int{sdjournal.SD_JOURNAL_SYSTEM, sdjournal.SD_JOURNAL_CURRENT_USER},
})

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