feat(aa-log): improve the journalctl filter.

This commit is contained in:
Alexandre Pujol 2024-05-03 13:01:10 +01:00
parent 9c0f4dd6a7
commit b636b4b3e9
No known key found for this signature in database
GPG Key ID: C5469996F0DF68EC

View File

@ -75,8 +75,13 @@ func GetJournalctlLogs(path string, useFile bool) (io.Reader, error) {
}
scanner = bufio.NewScanner(file)
} else {
// journalctl -b -o json --grep=apparmor --output-fields=MESSAGE > systemd.log
cmd := exec.Command("journalctl", "--boot", "--grep=apparmor", "--output=json", "--output-fields=MESSAGE")
// journalctl -b -o json -g apparmor -t kernel -t audit -t dbus-daemon --output-fields=MESSAGE > systemd.log
args := []string{
"--boot", "--grep=apparmor",
"--identifier=kernel", "--identifier=audit", "--identifier=dbus-daemon",
"--output=json", "--output-fields=MESSAGE",
}
cmd := exec.Command("journalctl", args...)
cmd.Stdout = &stdout
if err := cmd.Run(); err != nil {
return nil, err