Skip to content
Please update to the latest release 0.77.3 to address Multiple CVEs.
Linux.Sys.LogGrep

Linux.Sys.LogGrep

Provides zgrep-like search capabilities across log files, including gzipped log files, matching a glob for lines matching a regex.


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)
          })