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 {
|
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{
|
journal, err := sdjournal.NewJournalReader(sdjournal.JournalReaderConfig{
|
||||||
NumFromTail: bufLines,
|
NumFromTail: bufLines,
|
||||||
Matches: []sdjournal.Match{
|
Matches: []sdjournal.Match{
|
||||||
{
|
{
|
||||||
Field: sdjournal.SD_JOURNAL_FIELD_SYSTEMD_UNIT,
|
Field: field,
|
||||||
Value: u.unit,
|
Value: u.unit,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in New Issue
Block a user