Atlantiraptor Docs

Windows.EventLogs.Evtx

Type: Client · Author: Chris Hendricks (chris@counteractive.net)

Parses and returns events from Windows evtx logs.

Each event is returned in full, but results can be narrowed by using a glob pattern for evtx files, a timespan, and regexes to match the evtx path, event channel, and/or event ID:

  • EvtxGlob: glob of event log files (evtx) to target
  • StartDate: earliest event created timestamp to target
  • EndDate: latest event created timestamp to target
  • PathRegex: a regex to match against paths returned from EvtxGlob
  • ChannelRegex: a regex to match against the event channel
  • IDRegex: a regex to match against the event ID

Gathering these logs enables VQL analysis (e.g., via notebooks) and bulk export (e.g., to elasticsearch) for additional processing. It can also be used as the basis for custom artifacts with more in-depth filtering.

Note: This artifact can be resource intensive.

  • Parsing and aggregating may use high amounts of CPU on the client. Consider reducing the ops/second or narrowing the glob/path regex if necessary.
  • Parsing may use significant memory and time when searching VSS volumes and deduplicating events. This is proportional to the evtx file size and number of VSS copies. Consider whether the extra events are worth the resources.
  • Parsing many event logs may take longer than the default timeout. When parsing all log files and searching VSS, consider doubling the default or more (especially with reduced ops/second, or if targets have high-volume 3rd-party log sources such as Sysmon).
  • The artifact routinely produces hundreds of thousands of rows per host. Consider filtering results using path, channel, and ID regexes if necessary.

Inspired by others in Windows.EventLogs.*, many by Matt Green (@mgreen27).

Precondition: SELECT OS FROM info() WHERE OS = 'windows'

Parameters

Name Type Default Description
EvtxGlob string %SystemRoot%\System32\winevt\Logs\*.evtx
VSSAnalysisAge int 0 If larger than zero we analyze VSS within this many days ago. (e.g 7 will analyze all VSS within the last week). Note that when using VSS analysis we have to use the ntfs accessor for everything which will be much slower.
StartDate timestamp Parse events on or after this date (YYYY-MM-DDTmm:hh:ssZ)
EndDate timestamp Parse events on or before this date (YYYY-MM-DDTmm:hh:ssZ)
PathRegex regex .
ChannelRegex regex .
IDRegex regex .

Source

Defined in artifacts/definitions/Windows/EventLogs/Evtx.yaml.

name: Windows.EventLogs.Evtx

description: |
  Parses and returns events from Windows evtx logs.

  Each event is returned in full, but results can be narrowed by using a glob
  pattern for evtx files, a timespan, and regexes to match the evtx path, event
  channel, and/or event ID:

  - EvtxGlob: glob of event log files (evtx) to target
  - StartDate: earliest event created timestamp to target
  - EndDate: latest event created timestamp to target
  - PathRegex: a regex to match against paths returned from EvtxGlob
  - ChannelRegex: a regex to match against the event channel
  - IDRegex: a regex to match against the event ID

  Gathering these logs enables VQL analysis (_e.g._, via notebooks) and bulk
  export (_e.g._, to elasticsearch) for additional processing.  It can also be
  used as the basis for custom artifacts with more in-depth filtering.

  **Note: This artifact can be resource intensive.**

  - Parsing and aggregating may use high amounts of CPU on the client. Consider
  reducing the ops/second or narrowing the glob/path regex if necessary.
  - Parsing may use significant memory and time when searching VSS volumes and
  deduplicating events. This is proportional to the evtx file size and number
  of VSS copies. Consider whether the extra events are worth the resources.
  - Parsing many event logs may take longer than the default timeout.  When
  parsing all log files and searching VSS, consider doubling the default or
  more (especially with reduced ops/second, or if targets have high-volume
  3rd-party log sources such as Sysmon).
  - The artifact routinely produces hundreds of thousands of rows per host.
  Consider filtering results using path, channel, and ID regexes if necessary.

  Inspired by others in `Windows.EventLogs.*`, many by Matt Green (@mgreen27).

author: Chris Hendricks (chris@counteractive.net)

precondition: SELECT OS FROM info() WHERE OS = 'windows'

parameters:
  - name: EvtxGlob
    default: '%SystemRoot%\System32\winevt\Logs\*.evtx'
  - name: VSSAnalysisAge
    type: int
    default: 0
    description: |
      If larger than zero we analyze VSS within this many days
      ago. (e.g 7 will analyze all VSS within the last week).  Note
      that when using VSS analysis we have to use the ntfs accessor
      for everything which will be much slower.
  - name: StartDate
    type: timestamp
    description: "Parse events on or after this date (YYYY-MM-DDTmm:hh:ssZ)"
  - name: EndDate
    type: timestamp
    description: "Parse events on or before this date (YYYY-MM-DDTmm:hh:ssZ)"
  - name: PathRegex
    default: "."
    type: regex
  - name: ChannelRegex
    default: "."
    type: regex
  - name: IDRegex
    default: "."
    type: regex

export: |
  LET Levels <= dict(
    `0`='Always',
    `1`='Critical',
    `2`='Error',
    `3`='Warning',
    `4`='Info',
    `5`='Verbose')

sources:
  - query: |
      LET VSS_MAX_AGE_DAYS <= VSSAnalysisAge
      LET Accessor = if(condition=VSSAnalysisAge > 0, then="ntfs_vss", else="auto")

      // expand provided glob into a list of paths on the file system (fs)
      LET fspaths =
          SELECT OSPath FROM glob(globs=expand(path=EvtxGlob), accessor=Accessor)
          WHERE OSPath =~ PathRegex

      // function returning parsed evtx from list of paths
      LET evtxsearch(pathList) = SELECT * FROM foreach(
            row=pathList,
            query={
              SELECT *,
                timestamp(epoch=int(int=System.TimeCreated.SystemTime)) AS TimeCreated,
                System.Channel as Channel,
                System.EventRecordID as EventRecordID,
                System.EventID.Value as EventID,
                OSPath
              FROM parse_evtx(filename=OSPath, accessor=Accessor)
              WHERE
                if(condition=StartDate,
                   then=TimeCreated >= timestamp(string=StartDate),
                   else=true)
                AND if(condition=EndDate,
                       then=TimeCreated <= timestamp(string=EndDate),
                       else=true)
                AND Channel =~ ChannelRegex
                AND str(str=EventID) =~ IDRegex
            }
          )

      SELECT * FROM evtxsearch(pathList=fspaths)

    notebook:
       - name: Simplified view
         type: vql_suggestion
         template: |
            /*
            # Simplified log view
            */
            LET S = scope()

            SELECT TimeCreated,
                   System AS _System,
                   EventID,
                   get(item=Levels, field=str(str=System.Level)) AS Level,
                   S.System.Execution.ProcessID AS PID,
                   Message,
                   S.EventData AS Data
            FROM source()
            ORDER BY TimeCreated

       - name: Event count as plot
         type: vql_suggestion
         template: |
            /*
            # Event count

            {{ define "Events" }}
            SELECT int(int=TimeCreated.Unix / 60) * 60 AS MinBin,
                                    count() AS Count
              FROM source()
              GROUP BY MinBin
              ORDER BY MinBin
            {{ end }}
            {{ Query "Events" | TimeChart }}
            */

            LET Dummy <= 42

       - type: vql_suggestion
         name: Timeline
         template: |
          /*
          # EVTX timeline
          {{ Timeline "EVTX" }}
          */
          LET S = scope()

          LET _ <= timeline_add(key='TimeCreated',
                          name='evtx',
                          timeline='EVTX',
                          query={
              SELECT TimeCreated,
                    System AS _System,
                    EventID,
                    get(item=Levels, field=str(str=System.Level)) AS Level,
                    S.System.Execution.ProcessID AS PID,
                    Message,
                    S.EventData AS Data
              FROM source()
              ORDER BY TimeCreated
            })

Edit this page on GitHub

© 2026 Atlant Security EOOD. Atlantiraptor is free software under the GNU Affero General Public License v3. It is based on Velociraptor by Velocidex, and keeps its copyright notices. Velociraptor is a trademark of its owner; Atlantiraptor is not affiliated with or endorsed by it.