Linux.Forensics.Journal
Type: Client
Extracts records from systemd journal files for forensic analysis.
Systemd uses a binary log format to store logs. This parses the binary journal logs.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
JournalGlob |
glob | /{run,var}/log/journal/*/*.journal{,~} |
A Glob expression for finding journal files. |
IdentifierRegex |
regex | Regex of event source e.g sshd or kernel | |
IocRegex |
regex | IOC regex in event data | |
DateAfter |
timestamp | search for events after this date. YYYY-MM-DDTmm:hh:ssZ | |
DateBefore |
timestamp | search for events before this date. YYYY-MM-DDTmm:hh:ssZ | |
AlsoUpload |
bool | If set we also upload the raw files. |
Source
Defined in artifacts/definitions/Linux/Forensics/Journal.yaml.
name: Linux.Forensics.Journal
description: |
Extracts records from systemd journal files for forensic analysis.
Systemd uses a binary log format to store logs. This parses the
binary journal logs.
parameters:
- name: JournalGlob
type: glob
description: A Glob expression for finding journal files.
default: /{run,var}/log/journal/*/*.journal{,~}
- name: IdentifierRegex
type: regex
description: "Regex of event source e.g sshd or kernel"
- name: IocRegex
type: regex
description: "IOC regex in event data"
- name: DateAfter
type: timestamp
description: "search for events after this date. YYYY-MM-DDTmm:hh:ssZ"
- name: DateBefore
type: timestamp
description: "search for events before this date. YYYY-MM-DDTmm:hh:ssZ"
- name: AlsoUpload
type: bool
description: If set we also upload the raw files.
export: |
LET Priorities <= dict(`0`='emerg',
`1`='alert',
`2`='crit',
`3`='err',
`4`='warning',
`5`='notice',
`6`='info',
`7`='debug')
sources:
- name: Uploads
query: |
SELECT *
FROM if(condition=AlsoUpload,
then={
SELECT OSPath,
upload(file=OSPath) AS Upload
FROM glob(globs=JournalGlob)
})
- query: |
LET standard = SELECT *
FROM foreach(row={
SELECT OSPath
FROM glob(globs=JournalGlob)
},
query={
SELECT *
FROM parse_journald(filename=OSPath,
start_time=DateAfter,
end_time=DateBefore)
})
LET identifier_only = SELECT *
FROM foreach(row={
SELECT OSPath
FROM glob(globs=JournalGlob)
},
query={
SELECT *
FROM parse_journald(filename=OSPath,
start_time=DateAfter,
end_time=DateBefore)
WHERE EventData.SYSLOG_IDENTIFIER =~ IdentifierRegex
})
LET all_regex = SELECT *
FROM foreach(row={
SELECT OSPath
FROM glob(globs=JournalGlob)
},
query={
SELECT *
FROM parse_journald(filename=OSPath,
start_time=DateAfter,
end_time=DateBefore)
WHERE EventData.SYSLOG_IDENTIFIER =~ IdentifierRegex
AND format(format='%s_%s_%s',
args=[EventData, System._CMDLINE, System._EXE]) =~
IocRegex
})
LET ioc_only = SELECT *
FROM foreach(row={
SELECT OSPath
FROM glob(globs=JournalGlob)
},
query={
SELECT *
FROM parse_journald(filename=OSPath,
start_time=DateAfter,
end_time=DateBefore)
WHERE format(format='%s_%s_%s',
args=[EventData, System._CMDLINE,
System._EXE]) =~ IocRegex
})
SELECT *
FROM if(condition=IdentifierRegex
AND IocRegex,
then=all_regex,
else=if(condition=IdentifierRegex,
then=identifier_only,
else=if(condition=IocRegex, then=ioc_only, else=standard)))
notebook:
- type: vql_suggestion
name: Simplified view
template: |
/*
# Simplified log view
*/
SELECT System.Timestamp AS Timestamp,
EventData.SYSLOG_IDENTIFIER AS Unit,
get(item=Priorities, field=str(str=EventData.PRIORITY)) AS Level,
System._EXE AS Executable,
System._CMDLINE AS _Cmdline,
System._PID AS PID,
EventData.MESSAGE AS Message,
System AS _System,
EventData AS _EventData
FROM source()
ORDER BY Timestamp
- name: Message count as plot
type: vql_suggestion
template: |
/*
# Message count
{{ define "Messages" }}
SELECT int(int=System.Timestamp.Unix / 60) * 60 AS MinBin,
count() AS Count
FROM source()
GROUP BY MinBin
ORDER BY MinBin
{{ end }}
{{ Query "Messages" | TimeChart }}
*/
LET Dummy <= 42
- type: vql_suggestion
name: Timeline
template: |
/*
# Journal timeline
{{ Timeline "Journal" }}
*/
LET _ <= timeline_add(key='Timestamp',
name='journal',
timeline='Journal',
query={
SELECT System.Timestamp AS Timestamp,
EventData.SYSLOG_IDENTIFIER AS Unit,
get(item=Priorities, field=str(str=EventData.PRIORITY)) AS Level,
System._EXE AS Executable,
System._CMDLINE AS _Cmdline,
System._PID AS PID,
EventData.MESSAGE AS Message,
System,
EventData
FROM source()
})