Skip to main content

evtx2es

MIT License PyPI Version

evtx2es logo

A command-line tool and Python library for parsing Windows Event Logs and importing the results into Elasticsearch.

Life is too short to process huge Windows Event Logs using pure Python.
evtx2es leverages the Rust-based parser pyevtx-rs, making it significantly faster than traditional tools. It can also recover as many records as possible from corrupted, partially overwritten, or carved .evtx files.

Usage

evtx2es can be used as a standalone command-line tool or integrated directly into your Python scripts.

$ evtx2es /path/to/your/file.evtx
from evtx2es import evtx2es

evtx2es('/path/to/your/file.evtx')

Arguments

evtx2es can process multiple files at once:

$ evtx2es file1.evtx file2.evtx file3.evtx

evtx2es can recursively process all .evtx files under a specified directory:

$ tree .
evtxfiles/
  ├── file1.evtx
  ├── file2.evtx
  ├── file3.evtx
  └── subdirectory/
    ├── file4.evtx
    └── subsubdirectory/
      ├── file5.evtx
      └── file6.evtx

$ evtx2es /evtxfiles/ # This recursively processes file1 through file6.

Input and extraction errors are reported to stderr while remaining inputs are processed. Partial extraction exits 1, even with --quiet; output and Elasticsearch errors stop processing.

Options

--version, -v

--help, -h

--quiet, -q
  Suppress standard output
  (default: False)

--multiprocess, -m:
  Enable multiprocessing for faster processing.
  (default: False)

--size:
  Number of records to process per chunk (default: 500)

--host:
  Elasticsearch host address (default: localhost)

--port:
  Elasticsearch port number (default: 9200)

--index:
  Destination index name (default: evtx2es)

--scheme:
  Protocol scheme to use (http or https) (default: http)

--pipeline:
  Elasticsearch ingest pipeline to use (default: )

--datasetdate:
  Shift timestamps based on the latest record's `TimeCreated` value
  (MM/DD/YYYY.HH:MM:SS, interpreted as UTC). If omitted, timestamps are not shifted.

--tags:
  Comma-separated tags to add to each record (default: no additional tags).

--login:
  Username for Elasticsearch authentication

--pwd:
  Password for Elasticsearch authentication

--no-verify-certs:
  Disable TLS certificate verification (default: False)

--ca-certs:
  Path to a CA certificate bundle for TLS verification (default: None)

Examples

When using from the command line:

$ evtx2es /path/to/your/file.evtx --host=localhost --port=9200 --index=foobar --size=500

When using from a Python script:

evtx2es("/path/to/your/file.evtx", host="localhost", port=9200, index="foobar", chunk_size=500)

With Elasticsearch authentication:

$ evtx2es /path/to/your/file.evtx --host=localhost --port=9200 --index=foobar --login=elastic --pwd=******

TLS verification is enabled by default. For a private CA, use --ca-certs /path/to/ca.pem.

Appendix

evtx2json

evtx2es also includes evtx2json, a command-line tool for converting Windows Event Logs into JSON files. 🍣 🍣 🍣

$ evtx2json /path/to/your/file.evtx /path/to/output/target.json

Use --format jsonl (or ndjson) to write one record per line. The default output extension is .jsonl:

$ evtx2json /path/to/your/file.evtx --format jsonl

You can also convert .evtx files directly into a Python list[dict]:

from evtx2es import evtx2json

result: list[dict] = evtx2json('/path/to/your/file.evtx')

Python APIs raise PartialExtractionError on recovered partial results; JSON APIs expose completed records in the exception's records attribute.

Output Format Example

The following example uses a sample .evtx file from JPCERT/CC:LogonTracer.

[
  {
    "@timestamp": "2016-10-06T01:47:07.509504Z",
    "event": {
      "action": "eventlog-security-1102",
      "category": [
        "host"
      ],
      "type": [
        "info"
      ],
      "kind": "event",
      "provider": "microsoft-windows-eventlog",
      "module": "windows",
      "dataset": "windows.eventlog",
      "code": 1102,
      "created": "2016-10-06T01:47:07.509504Z"
    },
    "winlog": {
      "channel": "Security",
      "computer_name": "WIN-WFBHIBE5GXZ.example.co.jp",
      "event_id": 1102,
      "opcode": 0,
      "record_id": 227126,
      "task": 104,
      "version": 0,
      "provider": {
        "name": "Microsoft-Windows-Eventlog",
        "guid": "{fc65ddd8-d6ef-4962-83d5-6e5cfe9ce148}"
      }
    },
    "userdata": {
      "LogFileCleared": {
        "#attributes": {
          "xmlns:auto-ns3": "http://schemas.microsoft.com/win/2004/08/events",
          "xmlns": "http://manifests.microsoft.com/win/2004/08/windows/eventlog"
        },
        "SubjectUserSid": "S-1-5-21-1524084746-3249201829-3114449661-500",
        "SubjectUserName": "Administrator",
        "SubjectDomainName": "EXAMPLE",
        "SubjectLogonId": "0x32cfb"
      }
    },
    "process": {
      "pid": 960,
      "thread": {
        "id": 3020
      }
    },
    "log": {
      "file": {
        "path": "/path/to/your/Security.evtx"
      }
    },
    "tags": [
      "eventlog"
    ]
  },
  ...
]

Performance Evaluation (v1.8.0)

Performance was evaluated using a sample .evtx file from JPCERT/CC:LogonTracer (approx. 30MB of binary data).

$ time uv run evtx2es Security.evtx
Importing Security.evtx...
1it [00:08,  8.09s/it]
Bulk import completed: 1 batches processed
Successfully indexed: 62031 documents
Import completed successfully.

________________________________________________________
Executed in    8.60 secs    fish           external
   usr time    4.85 secs  481.00 micros    4.85 secs
   sys time    0.40 secs    0.00 micros    0.40 secs

Running Environment

OS: Ubuntu 20.04 (Dev Container on WSL2)
CPU: Intel Core i5-12400F
RAM: DDR4 32GB

The tests were conducted within the provided development container, pushing data into a local Elasticsearch 9.0.2 Docker container.

Installation

From PyPI

$ pip install evtx2es

With uv

$ uv add evtx2es

From GitHub Releases

Standalone binaries are available from GitHub Releases for systems without a Python environment.

$ chmod +x ./evtx2es
$ ./evtx2es {{options...}}
> evtx2es.exe {{options...}}

Contributing

The source code for evtx2es is hosted on GitHub: https://github.com/sumeshi/evtx2es. Please report issues and feature requests. 🍣 🍣 🍣

Included in

Thank you for your interest in evtx2es!

License

Released under the MIT License.

Third-party licenses

Standalone releases are ZIP archives containing both commands and LICENSES.txt with project, runtime dependency and Python license notices. Keep the notices with the executables when redistributing them.

For the parser binding, which declares MIT but supplies no license file, the archive includes the standard MIT text and upstream attribution. See .github/LICENSE-NOTES.md for provenance.

The standalone binaries distributed via GitHub Releases may bundle the following third-party libraries. These libraries remain under their original licenses.

Apache-2.0

MIT

Apache-2.0 OR MIT, with MPL-2.0 components

MIT and MPL-2.0

Metadata

Release files for evtx2es 1.13.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for evtx2es 1.13.0
File Size Uploaded
evtx2es-1.13.0.tar.gz 70.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for evtx2es 1.13.0
File Interpreter ABI Platform
evtx2es-1.13.0-py3-none-any.whl Python 3 none any Details

Total release size: 91.0 kB

Release files / evtx2es-1.13.0.tar.gz

Download URL evtx2es-1.13.0.tar.gz
Size 70.0 kB
Tags Source
SHA-256 checksum
How to use checksums
af0bc50bdc0bbd334184332ecd00476a9fdb840cbd10e4fa117818214a763759
BLAKE2b-256 checksum
How to use checksums
879ca8f1dcf8fc097ed5d1dc0a461030d9abef09a5fd87f923deebd51d9b1a17
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.13.0 {"installer":{"name":"uv","version":"0.13.0","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / evtx2es-1.13.0-py3-none-any.whl

Download URL evtx2es-1.13.0-py3-none-any.whl
Size 21.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
3bd524b614214188f3265cd4ba703df52204a51b1d4fe6f6bcac6787e5ca3855
BLAKE2b-256 checksum
How to use checksums
477414166fbd08d93e13b8532cbe3e1e465844acf65551f0485ea55cd135c3a2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.13.0 {"installer":{"name":"uv","version":"0.13.0","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release history Release notifications | RSS feed

This release

1.13.0 This release

2 release files

1.11.3

2 release files

1.11.2

2 release files

1.11.1

2 release files

1.11.0

2 release files

1.9.0

2 release files

1.8.0

2 release files

1.7.6

2 release files

1.7.5

2 release files

1.7.4

2 release files

1.7.3

2 release files

1.7.2

2 release files

1.7.1

2 release files

1.7.0

2 release files

1.6.1

2 release files

1.6.0

2 release files

1.5.5

2 release files

1.5.2

2 release files

1.5.1

2 release files

1.5.0

2 release files

1.4.6

2 release files

1.4.3

2 release files

1.4.2

2 release files

1.4.1

2 release files

1.4.0

2 release files

1.3.3

2 release files

1.3.2

2 release files

1.3.1

2 release files

1.3.0

2 release files

1.2.0

2 release files

1.1.5

2 release files

1.1.4

2 release files

1.1.3

2 release files

1.1.2

2 release files

1.1.1

2 release files

1.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page