Fix systemd logs retrieval
This commit is contained in:
parent
79a2c8aa66
commit
c843eebdd7
|
@ -119,11 +119,16 @@ func (u *SystemdUnit) Stop(ctx context.Context) error {
|
|||
}
|
||||
|
||||
func (u *SystemdUnit) Logs(context.Context) []string {
|
||||
field := sdjournal.SD_JOURNAL_FIELD_SYSTEMD_UNIT
|
||||
if u.user {
|
||||
field = sdjournal.SD_JOURNAL_FIELD_SYSTEMD_USER_UNIT
|
||||
}
|
||||
|
||||
journal, err := sdjournal.NewJournalReader(sdjournal.JournalReaderConfig{
|
||||
NumFromTail: bufLines,
|
||||
Matches: []sdjournal.Match{
|
||||
{
|
||||
Field: sdjournal.SD_JOURNAL_FIELD_SYSTEMD_UNIT,
|
||||
Field: field,
|
||||
Value: u.unit,
|
||||
},
|
||||
},
|
||||
|
|
Loading…
Reference in New Issue
Block a user