Skip to content

Windows event logs (EVTX)

Parse Windows .evtx event-log files into queryable SQL rows for forensics and incident response

Connector software
Free and open source
Service credentials
Not needed
Use with an agent

Install the Orchard skill in your project to help your agent find connectors, configure them, and verify SQL results.

npx skills add Query-farm/vgi-skills --skill orchard

Copy this request into your coding agent to get started.

Use https://query.farm/products/orchard/connectors/evtx/index.md to help me query Windows event logs (EVTX) with DuckDB or Haybarn 2.0.1 and VGI protocol 3.4. Ask only for missing details about the result I need or whether I want local execution, self-hosting or Query Farm hosting. Check the connector's actual hosting availability, credentials and input requirements. Read one format of each needed reference and the exact object declarations before writing SQL. Use a released connector, and distinguish a saved example result from anything you actually execute. If you cannot run the query, tell me what remains to verify.

See what you can query

Example output · captured
Connector release
v0.5.0
Engine
2.0.1
VGI protocol
3.4.0
SET VARIABLE evtx_sample = (SELECT content FROM read_blob('https://raw.githubusercontent.com/Query-farm/vgi-evtx/v0.4.0/test/sql/data/sample-security.evtx')); SELECT record_id, event_id, provider, time_created
FROM evtx.main.evtx_records(getvariable('evtx_sample'))
ORDER BY record_id;
Result · first 5 rows
record_id event_id provider time_created
1 5152 Microsoft-Windows-Security-Auditing 2016-06-29T15:24:34.346000
2 4611 Microsoft-Windows-Security-Auditing 2016-06-29T15:24:36.686000
3 4776 Microsoft-Windows-Security-Auditing 2016-06-29T15:24:36.686000
4 4625 Microsoft-Windows-Security-Auditing 2016-06-29T15:24:36.717200
5 5152 Microsoft-Windows-Security-Auditing 2016-06-29T15:24:57.090800

Quick start

Choose where to run Windows event logs (EVTX), then follow the steps below.

The connector runs alongside DuckDB or Haybarn. No Query Farm account is needed.

1. Install the vgi extension

Run this in your SQL client. On DuckDB, keep FROM query_farm on LOAD in later sessions.

setup.sql
SET allow_extension_repositories = 'allowed';

CREATE EXTENSION REPOSITORY IF NOT EXISTS query_farm
    WITH PREFIX 'https://duckdb-extensions.query.farm';

INSTALL vgi FROM query_farm;
LOAD vgi FROM query_farm;

2. Attach the connector

Attach the release directly

Downloads the latest release for your platform and caches it locally.

ATTACH 'evtx' AS evtx (
  TYPE vgi,
  LOCATION 'github-auto://Query-farm/vgi-evtx'
);

3. Run a query

query.sql
SET VARIABLE evtx_sample = (SELECT content FROM read_blob('https://raw.githubusercontent.com/Query-farm/vgi-evtx/v0.4.0/test/sql/data/sample-security.evtx')); SELECT record_id, event_id, provider, time_created
FROM evtx.main.evtx_records(getvariable('evtx_sample'))
ORDER BY record_id;
More example queries →
Technical details
Verified connector release
v0.5.0
Engine
2.0.1
VGI protocol
3.4.0
Verified on
December 1, 2026
Release notes on GitHub
Pin a version for production

When running the connector yourself, keep a specific release until you’re ready to upgrade. Replace the ATTACH statement above with this one and follow the same extension and credential setup.

Attach the release directly

Uses the verified release each time you attach the connector.

ATTACH 'evtx' AS evtx (
  TYPE vgi,
  LOCATION 'github-auto://Query-farm/[email protected]'
);

Overview

Windows Event Log (.evtx) parsing for defensive DFIR — turn event-log files into queryable rows.

Catalog

Everything evtx exposes once attached — read straight from the worker's released build.

evtx 1 schema
main 1 view · 3 functions

Windows Event Log (.evtx) parsing and inspection functions.

Schema examples (7)
Examples (7)

Validate that a file's bytes (a sample Security log fetched by URL) are a parseable .evtx before loading it.

SELECT evtx.main.is_valid_evtx((SELECT content FROM read_blob('https://raw.githubusercontent.com/Query-farm/vgi-evtx/v0.4.0/test/sql/data/sample-security.evtx')));

Count how many event records a .evtx file (a sample Security log fetched by URL) contains.

SELECT evtx.main.evtx_record_count((SELECT content FROM read_blob('https://raw.githubusercontent.com/Query-farm/vgi-evtx/v0.4.0/test/sql/data/sample-security.evtx')));

Explode a .evtx file into one row per event record, ordered by record id (the sample log's bytes are fetched by URL into a variable, since table-function arguments must be constants).

SET VARIABLE evtx_sample = (SELECT content FROM read_blob('https://raw.githubusercontent.com/Query-farm/vgi-evtx/v0.4.0/test/sql/data/sample-security.evtx')); SELECT record_id, event_id, provider, time_created
FROM evtx.main.evtx_records(getvariable('evtx_sample'))
ORDER BY record_id;
Result · first 5 rows
record_id event_id provider time_created
1 5152 Microsoft-Windows-Security-Auditing 2016-06-29T15:24:34.346000
2 4611 Microsoft-Windows-Security-Auditing 2016-06-29T15:24:36.686000
3 4776 Microsoft-Windows-Security-Auditing 2016-06-29T15:24:36.686000
4 4625 Microsoft-Windows-Security-Auditing 2016-06-29T15:24:36.717200
5 5152 Microsoft-Windows-Security-Auditing 2016-06-29T15:24:57.090800

Rank event ids by how often they occur to surface the noisiest activity.

SET VARIABLE evtx_sample = (SELECT content FROM read_blob('https://raw.githubusercontent.com/Query-farm/vgi-evtx/v0.4.0/test/sql/data/sample-security.evtx')); SELECT event_id, count(*) AS n
FROM evtx.main.evtx_records(getvariable('evtx_sample'))
GROUP BY event_id
ORDER BY n DESC;
3 more examples

Label each parsed record with its human-readable meaning by LEFT JOINing the event id reference onto evtx_records (meaning is NULL for ids the reference does not catalogue).

SET VARIABLE evtx_sample = (SELECT content FROM read_blob('https://raw.githubusercontent.com/Query-farm/vgi-evtx/v0.4.0/test/sql/data/sample-security.evtx')); SELECT r.record_id, r.event_id, ref.name AS meaning, r.time_created
FROM evtx.main.evtx_records(getvariable('evtx_sample')) AS r
LEFT JOIN evtx.main.windows_event_id_reference AS ref ON ref.event_id = r.event_id AND ref.channel = r.channel
ORDER BY r.record_id;

Hunt failed logons and lockouts: select the event ids from the reference by name, then pull the targeted account and source IP address out of each matching record's event_json.

SET VARIABLE evtx_sample = (SELECT content FROM read_blob('https://raw.githubusercontent.com/Query-farm/vgi-evtx/v0.4.0/test/sql/data/sample-security.evtx')); SELECT r.record_id, r.time_created, ref.name, r.event_json->>'$.Event.EventData.TargetUserName' AS target_user, r.event_json->>'$.Event.EventData.IpAddress' AS source_ip
FROM evtx.main.evtx_records(getvariable('evtx_sample')) AS r
JOIN evtx.main.windows_event_id_reference AS ref ON ref.event_id = r.event_id AND ref.channel = r.channel
WHERE ref.name IN ('Failed logon', 'Account locked out')
ORDER BY r.time_created, r.record_id;

Triage a set of collected files (here a sample .evtx and a README fetched by URL): flag which ones are parseable .evtx logs and how many event records each holds (non-evtx files show valid = false and 0 records).

SELECT filename, evtx.main.is_valid_evtx(content) AS valid,
  evtx.main.evtx_record_count(content) AS records
FROM read_blob(['https://raw.githubusercontent.com/Query-farm/vgi-evtx/v0.4.0/test/sql/data/README.md', 'https://raw.githubusercontent.com/Query-farm/vgi-evtx/v0.4.0/test/sql/data/sample-security.evtx'])
ORDER BY filename;
Views
windows_event_id_reference 3 examples4 cols

Curated registry of well-known Windows Event IDs (Security, System, Sysmon, PowerShell) with a short name and DFIR relevance note; browsable and joinable onto evtx_records.event_id.

Columns
event_id INTEGER
The Windows Event ID (matches evtx_records.event_id).
channel VARCHAR
The log channel the event id is emitted on, e.g. Security, System, or a Sysmon/PowerShell operational channel.
name VARCHAR
A short human-readable label for the event id.
dfir_use VARCHAR
Why the event id matters in digital-forensics and incident-response analysis.
Examples (3)

Look up the meaning and DFIR relevance of a single Windows event id.

SELECT name, dfir_use
FROM evtx.main.windows_event_id_reference
WHERE event_id = 4688;

List the curated Security-channel event ids in numeric order.

SELECT event_id, name
FROM evtx.main.windows_event_id_reference
WHERE channel = 'Security'
ORDER BY event_id;

Hunt failed logons and lockouts: select the event ids from the reference by name, then pull the targeted account and source IP address out of each matching record's event_json.

SET VARIABLE evtx_sample = (SELECT content FROM read_blob('https://raw.githubusercontent.com/Query-farm/vgi-evtx/v0.4.0/test/sql/data/sample-security.evtx')); SELECT r.record_id, r.time_created, ref.name, r.event_json->>'$.Event.EventData.TargetUserName' AS target_user, r.event_json->>'$.Event.EventData.IpAddress' AS source_ip
FROM evtx.main.evtx_records(getvariable('evtx_sample')) AS r
JOIN evtx.main.windows_event_id_reference AS ref ON ref.event_id = r.event_id AND ref.channel = r.channel
WHERE ref.name IN ('Failed logon', 'Account locked out')
ORDER BY r.time_created, r.record_id;
Link
Scalar functions
evtx_record_count (input ANY) 2 examples

Number of event records in a .evtx file (BLOB bytes or VARCHAR path); 0 for malformed/garbage input

Arguments
input ANY
The Windows Event Log (.evtx) to inspect: either the raw file contents supplied inline, or a filesystem path to the .evtx file to open and read.
ReturnsBIGINT
Examples (2)

Count the event records in a sample Security .evtx file read as a BLOB from a URL (7 records).

SELECT evtx.main.evtx_record_count((SELECT content FROM read_blob('https://raw.githubusercontent.com/Query-farm/vgi-evtx/v0.4.0/test/sql/data/sample-security.evtx')));

Non-evtx bytes count as 0 records (hostile input is handled, not an error).

SELECT evtx.main.evtx_record_count('not a real evtx'::BLOB) AS records;
Link
is_valid_evtx (input ANY) 3 examples

True if the input is a parseable .evtx (has the ElfFile magic and the parser constructs); false for malformed/garbage input

Arguments
input ANY
The Windows Event Log (.evtx) to inspect: either the raw file contents supplied inline, or a filesystem path to the .evtx file to open and read.
ReturnsBOOLEAN
Examples (3)

Check whether a file's bytes (a sample Security log fetched by URL) are a parseable .evtx before processing.

SELECT evtx.main.is_valid_evtx((SELECT content FROM read_blob('https://raw.githubusercontent.com/Query-farm/vgi-evtx/v0.4.0/test/sql/data/sample-security.evtx')));

Non-evtx bytes are reported as not valid (false), not an error.

SELECT evtx.main.is_valid_evtx('not a real evtx'::BLOB) AS valid;

Triage a set of collected files (here a sample .evtx and a README fetched by URL): flag which ones are parseable .evtx logs and how many event records each holds (non-evtx files show valid = false and 0 records).

SELECT filename, evtx.main.is_valid_evtx(content) AS valid,
  evtx.main.evtx_record_count(content) AS records
FROM read_blob(['https://raw.githubusercontent.com/Query-farm/vgi-evtx/v0.4.0/test/sql/data/README.md', 'https://raw.githubusercontent.com/Query-farm/vgi-evtx/v0.4.0/test/sql/data/sample-security.evtx'])
ORDER BY filename;
Link
Table functions
evtx_records (input BLOB) +1 overload 6 examples

Parse a .evtx file (BLOB bytes or VARCHAR path) into one row per event record; event_json carries the full normalized event JSON

Arguments
input BLOB
The Windows Event Log (.evtx) to explode into rows: either the raw file contents supplied inline, or a filesystem path to the .evtx file to open and read.
Overloads
evtx_records(input BLOB)evtx_records(input VARCHAR)
Returns columns
record_id BIGINT
The event record's identifier, assigned in file order.
event_id INTEGER
The Windows Event ID from Event.System.EventID (e.g. 4624 = successful logon).
provider VARCHAR
Event provider name from Event.System.Provider/@Name (e.g. Microsoft-Windows-Security-Auditing).
channel VARCHAR
Log channel the record came from, e.g. Security, System, Application.
computer VARCHAR
Source computer name from Event.System.Computer.
level INTEGER
Severity level from Event.System.Level (lower is more severe; 2 = Error, 3 = Warning, 4 = Information).
time_created TIMESTAMP
Record header creation time in UTC, microsecond precision.
event_json VARCHAR
The full normalized event as JSON; feeds vgi-sigma's sigma_match(event_json, rule).
Examples (6)

Explode a .evtx file into one row per event record, ordered by record id. Table-function arguments must be constants, so the sample log's bytes are fetched by URL into a variable first.

SET VARIABLE evtx_sample = (SELECT content FROM read_blob('https://raw.githubusercontent.com/Query-farm/vgi-evtx/v0.4.0/test/sql/data/sample-security.evtx')); SELECT record_id, event_id, provider, time_created
FROM evtx.main.evtx_records(getvariable('evtx_sample'))
ORDER BY record_id;
Result · first 5 rows
record_id event_id provider time_created
1 5152 Microsoft-Windows-Security-Auditing 2016-06-29T15:24:34.346000
2 4611 Microsoft-Windows-Security-Auditing 2016-06-29T15:24:36.686000
3 4776 Microsoft-Windows-Security-Auditing 2016-06-29T15:24:36.686000
4 4625 Microsoft-Windows-Security-Auditing 2016-06-29T15:24:36.717200
5 5152 Microsoft-Windows-Security-Auditing 2016-06-29T15:24:57.090800

Label each parsed record with its human-readable meaning by LEFT JOINing the event id reference onto evtx_records (meaning is NULL for ids the reference does not catalogue).

SET VARIABLE evtx_sample = (SELECT content FROM read_blob('https://raw.githubusercontent.com/Query-farm/vgi-evtx/v0.4.0/test/sql/data/sample-security.evtx')); SELECT r.record_id, r.event_id, ref.name AS meaning, r.time_created
FROM evtx.main.evtx_records(getvariable('evtx_sample')) AS r
LEFT JOIN evtx.main.windows_event_id_reference AS ref ON ref.event_id = r.event_id AND ref.channel = r.channel
ORDER BY r.record_id;

Rank event ids by frequency to surface the noisiest activity in a log.

SET VARIABLE evtx_sample = (SELECT content FROM read_blob('https://raw.githubusercontent.com/Query-farm/vgi-evtx/v0.4.0/test/sql/data/sample-security.evtx')); SELECT event_id, count(*) AS n
FROM evtx.main.evtx_records(getvariable('evtx_sample'))
GROUP BY event_id
ORDER BY n DESC;
3 more examples
SELECT count(*) AS n FROM evtx.main.evtx_records('not a real evtx'::BLOB);
SELECT evtx.main.is_valid_evtx('not a real evtx'::BLOB) AS valid;
SELECT evtx.main.evtx_record_count('not a real evtx'::BLOB) AS records;
Link

Try these queries

Validate that a file's bytes (a sample Security log fetched by URL) are a parseable .evtx before loading it.

SELECT evtx.main.is_valid_evtx((SELECT content FROM read_blob('https://raw.githubusercontent.com/Query-farm/vgi-evtx/v0.4.0/test/sql/data/sample-security.evtx')));

Uses is_valid_evtx

Count how many event records a .evtx file (a sample Security log fetched by URL) contains.

SELECT evtx.main.evtx_record_count((SELECT content FROM read_blob('https://raw.githubusercontent.com/Query-farm/vgi-evtx/v0.4.0/test/sql/data/sample-security.evtx')));

Uses evtx_record_count

Rank event ids by how often they occur to surface the noisiest activity.

SET VARIABLE evtx_sample = (SELECT content FROM read_blob('https://raw.githubusercontent.com/Query-farm/vgi-evtx/v0.4.0/test/sql/data/sample-security.evtx')); SELECT event_id, count(*) AS n
FROM evtx.main.evtx_records(getvariable('evtx_sample'))
GROUP BY event_id
ORDER BY n DESC;

Uses evtx_records

Label each parsed record with its human-readable meaning by LEFT JOINing the event id reference onto evtx_records (meaning is NULL for ids the reference does not catalogue).

SET VARIABLE evtx_sample = (SELECT content FROM read_blob('https://raw.githubusercontent.com/Query-farm/vgi-evtx/v0.4.0/test/sql/data/sample-security.evtx')); SELECT r.record_id, r.event_id, ref.name AS meaning, r.time_created
FROM evtx.main.evtx_records(getvariable('evtx_sample')) AS r
LEFT JOIN evtx.main.windows_event_id_reference AS ref ON ref.event_id = r.event_id AND ref.channel = r.channel
ORDER BY r.record_id;

Uses evtx_recordswindows_event_id_reference

Hunt failed logons and lockouts: select the event ids from the reference by name, then pull the targeted account and source IP address out of each matching record's event_json.

SET VARIABLE evtx_sample = (SELECT content FROM read_blob('https://raw.githubusercontent.com/Query-farm/vgi-evtx/v0.4.0/test/sql/data/sample-security.evtx')); SELECT r.record_id, r.time_created, ref.name, r.event_json->>'$.Event.EventData.TargetUserName' AS target_user, r.event_json->>'$.Event.EventData.IpAddress' AS source_ip
FROM evtx.main.evtx_records(getvariable('evtx_sample')) AS r
JOIN evtx.main.windows_event_id_reference AS ref ON ref.event_id = r.event_id AND ref.channel = r.channel
WHERE ref.name IN ('Failed logon', 'Account locked out')
ORDER BY r.time_created, r.record_id;

Uses evtx_recordswindows_event_id_reference

Look up the meaning and DFIR relevance of a single Windows event id.

SELECT name, dfir_use
FROM evtx.main.windows_event_id_reference
WHERE event_id = 4688

Uses windows_event_id_reference

5 more examples in the Catalog, each listed under the table or function it uses.

Questions it can answer

Plain-English questions from the worker's agent test tasks. An AI agent with this catalog attached should answer each one with SQL.

  • Using the evtx worker's built-in Windows Event ID reference data, what is the short name for event id 4688?
  • Using the evtx worker's Windows Event ID reference, how many distinct Security-channel event ids does it catalogue?

Windows event logs (EVTX) is an independent open-source connector from Query.Farm. It is not affiliated with, endorsed by or sponsored by the services, projects or organisations it works with. Product names, logos and trademarks belong to their respective owners.