Linux.Sys.LogGrep
Type: Client · Author: Matt Green - @mgreen27
Provides zgrep-like search capabilities across log files, including gzipped log files, matching a glob for lines matching a regex.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
TargetGlob |
string | /var/log/** |
|
GrepRegex |
regex | malware\.php |
Regex of strings to search in line. |
WhitelistRegex |
regex | Regex of strings to leave out of output. |
Source
Defined in artifacts/definitions/Linux/Sys/LogGrep.yaml.
name: Linux.Sys.LogGrep
author: "Matt Green - @mgreen27"
description: |
Provides zgrep-like search capabilities across log files, including
gzipped log files, matching a glob for lines matching a regex.
parameters:
- name: TargetGlob
default: /var/log/**
- name: GrepRegex
type: regex
description: "Regex of strings to search in line."
default: 'malware\.php'
- name: WhitelistRegex
type: regex
description: "Regex of strings to leave out of output."
default:
sources:
- query: |
LET files = SELECT OSPath FROM glob(globs=TargetGlob)
WHERE NOT IsDir
SELECT * FROM foreach(row=files,
query={
SELECT Line, OSPath FROM parse_lines(filename=OSPath)
WHERE
Line =~ GrepRegex
AND NOT if(condition= WhitelistRegex,
then= Line =~ WhitelistRegex,
else= FALSE)
})