Windows Event Log

Collect logs from Windows Event Log channels using the native Windows Event Log API

status: beta role: daemon delivery: at-least-once acknowledgements: yes egress: stream state: stateful
output: logs
Collects log events from Windows Event Log channels using the native Windows Event Log API.

Requirements

This source is only supported on Windows. Attempting to use it on other operating systems will result in an error at startup.

Configuration

Example configurations

{
  "sources": {
    "my_source_id": {
      "type": "windows_event_log",
      "channels": [
        "System,Application,Security"
      ]
    }
  }
}
[sources.my_source_id]
type = "windows_event_log"
channels = [ "System,Application,Security" ]
sources:
  my_source_id:
    type: windows_event_log
    channels:
      - System,Application,Security
{
  "sources": {
    "my_source_id": {
      "type": "windows_event_log",
      "batch_size": 100,
      "channels": [
        "System,Application,Security"
      ],
      "checkpoint_interval_secs": 5,
      "connection_timeout_secs": 30,
      "data_dir": "/var/lib/vector",
      "event_query": "*[System[Level=1 or Level=2 or Level=3]]",
      "event_timeout_ms": 5000,
      "events_per_second": 100,
      "ignore_event_ids": [
        4624
      ],
      "max_event_age_secs": 86400,
      "max_event_data_length": 1024,
      "only_event_ids": [
        1000
      ],
      "render_message": true
    }
  }
}
[sources.my_source_id]
type = "windows_event_log"
batch_size = 100
channels = [ "System,Application,Security" ]
checkpoint_interval_secs = 5
connection_timeout_secs = 30
data_dir = "/var/lib/vector"
event_query = "*[System[Level=1 or Level=2 or Level=3]]"
event_timeout_ms = 5_000
events_per_second = 100
ignore_event_ids = [ 4_624 ]
max_event_age_secs = 86_400
max_event_data_length = 1_024
only_event_ids = [ 1_000 ]
render_message = true
sources:
  my_source_id:
    type: windows_event_log
    batch_size: 100
    channels:
      - System,Application,Security
    checkpoint_interval_secs: 5
    connection_timeout_secs: 30
    data_dir: /var/lib/vector
    event_query: "*[System[Level=1 or Level=2 or Level=3]]"
    event_timeout_ms: 5000
    events_per_second: 100
    ignore_event_ids:
      - 4624
    max_event_age_secs: 86400
    max_event_data_length: 1024
    only_event_ids:
      - 1000
    render_message: true

acknowledgements

optional object

Deprecated

This field is deprecated.

Controls how acknowledgements are handled for this source.

When enabled, the source will wait for downstream sinks to acknowledge receipt of events before updating checkpoints. This provides exactly-once delivery guarantees at the cost of potential duplicate events on restart if acknowledgements are pending.

When disabled (default), checkpoints are updated immediately after reading events, which may result in data loss if Vector crashes before events are delivered to sinks.

Whether or not end-to-end acknowledgements are enabled for this source.

batch_size

optional uint

Batch size for event processing.

This controls how many events are processed in a single batch.

Examples
10
100
default: 100

channels

required [string]

A comma-separated list of channels to read from.

Common channels include “System”, “Application”, “Security”, “Windows PowerShell”. Use Windows Event Viewer to discover available channels.

Array string literal
Examples
[
  "System,Application,Security",
  "System"
]

checkpoint_interval_secs

optional uint

Interval in seconds between periodic checkpoint flushes.

Controls how often bookmarks are persisted to disk in synchronous mode. Lower values reduce the window of events that may be re-processed after a crash, at the cost of more frequent disk writes.

Examples
5
1
30
default: 5

connection_timeout_secs

optional uint

Connection timeout in seconds for event subscription.

This controls how long to wait for event subscription connection.

Examples
30
60
default: 30

data_dir

optional string literal

The directory where checkpoint data is stored.

By default, the global data_dir option is used. Make sure the running user has write permissions to this directory.

Examples
"/var/lib/vector"
"C:\\ProgramData\\vector"

event_data_format

optional object

Custom event data formatting options.

Maps event field names to custom formatting options.

event_data_format.*

required string literal enum
An individual event data format override.
Enum options
OptionDescription
autoKeep the original format unchanged (passthrough). The field value will not be converted or modified.
booleanParse and format the field value as a boolean. Recognizes “true”, “1”, “yes”, “on” as true (case-insensitive).
floatParse and format the field value as a floating-point number.
integerParse and format the field value as an integer.
stringFormat the field value as a string.
Examples
"auto"
"boolean"
"float"
"integer"
"string"

event_query

optional string literal

The XPath query for filtering events.

Allows filtering events using XML Path Language queries. If not specified, all events from the specified channels will be collected.

Examples
"*[System[Level=1 or Level=2 or Level=3]]"
"*[System[(Level=1 or Level=2 or Level=3) and TimeCreated[timediff(@SystemTime) \u003c= 86400000]]]"

event_timeout_ms

optional uint

Timeout in milliseconds for waiting for new events.

Controls the maximum time WaitForMultipleObjects blocks before returning to check for shutdown signals. Lower values increase shutdown responsiveness at the cost of more frequent wake-ups.

Examples
5000
10000
default: 5000

events_per_second

optional uint

Maximum number of events to process per second.

When set to a non-zero value, Vector will rate-limit event processing to prevent overwhelming downstream systems. A value of 0 (default) means no rate limiting is applied.

Examples
100
1000
5000

field_filter

optional object

Event field inclusion/exclusion patterns.

Controls which event fields are included in the output.

Fields to exclude from the output.

These fields will be removed from the event data.

Whether to include event data fields.

Event data fields contain application-specific data.

default: true

Fields to include in the output.

If specified, only these fields will be included.

Whether to include system fields.

System fields include metadata like Computer, TimeCreated, etc.

default: true

Whether to include user data fields.

User data fields contain additional custom data.

default: true

ignore_event_ids

optional [uint]

Ignore specific event IDs.

Events with these IDs will be filtered out and not sent downstream.

Array uint
Examples
[
  4624,
  4625,
  4634
]

include_xml

optional bool

Whether to include raw XML data in the output.

When enabled, the raw XML representation of the event is included in the xml field of the output event.

default: false

max_event_age_secs

optional uint

Maximum age of events to process (in seconds).

Events older than this value will be ignored. If not specified, all events will be processed regardless of age.

Examples
86400
604800

max_event_data_length

optional uint

Maximum length for event data field values.

Event data values longer than this will be truncated with “…[truncated]” appended. Set to 0 for no limit.

Examples
1024
4096

only_event_ids

optional [uint]

Only include specific event IDs.

If specified, only events with these IDs will be processed. Takes precedence over ignore_event_ids.

Array uint
Examples
[
  1000,
  1001,
  1002
]

read_existing_events

optional bool

Whether to read existing events or only new events.

When set to true, the source will read all existing events from the channels. When set to false (default), only new events will be read.

default: false

render_message

optional bool

Whether to render human-readable event messages.

When enabled (default), Vector will use the Windows EvtFormatMessage API to render localized, human-readable event messages with parameter substitution. This matches the behavior of Windows Event Viewer.

Provider DLL handles are cached per provider, so the performance cost is limited to the first event from each provider. Disable only if you do not need rendered messages and want to eliminate the DLL loads entirely.

default: true

Outputs

<component_id>

Default output stream of the component. Use this component’s ID as an input to downstream transforms and sinks.

Output Types

Logs

Warning

The fields shown below will be different if log namespacing is enabled. See Log Namespacing for more details

Event

An individual Windows Event Log event.
Fields
channel optional string literal
The event log channel name.
Examples
System
Application
Security
computer optional string literal
The name of the computer that generated the event.
Examples
DESKTOP-ABC123
event_id optional uint
The event identifier.
Examples
7036
4624
1000
level optional string literal
The event severity level.
Examples
Information
Warning
Error
Critical
message optional string literal
The rendered event message.
Examples
The service was started successfully.
provider_name optional string literal
The name of the event provider.
Examples
Microsoft-Windows-Security-Auditing
source_type required string literal
The name of the source type.
Examples
windows_event_log
timestamp optional timestamp
The timestamp of the event.
Examples
2020-10-10T17:07:36.452332Z

Telemetry

Metrics

link

component_discarded_events_total

counter
The number of events dropped by this component.
component_id
The Vector component ID.
component_kind
The Vector component kind.
component_type
The Vector component type.
host optional
The hostname of the system Vector is running on.
intentional
True if the events were discarded intentionally, like a filter transform, or false if due to an error.
pid optional
The process ID of the Vector instance.

component_errors_total

counter
The total number of errors encountered by this component.
component_id
The Vector component ID.
component_kind
The Vector component kind.
component_type
The Vector component type.
error_type
The type of the error
host optional
The hostname of the system Vector is running on.
pid optional
The process ID of the Vector instance.
stage
The stage within the component at which the error occurred.

component_received_bytes_total

counter
The number of raw bytes accepted by this component from source origins.
component_id
The Vector component ID.
component_kind
The Vector component kind.
component_type
The Vector component type.
container_name optional
The name of the container from which the data originated.
file optional
The file from which the data originated.
host optional
The hostname of the system Vector is running on.
mode optional
The connection mode used by the component.
peer_addr optional
The IP from which the data originated.
peer_path optional
The pathname from which the data originated.
pid optional
The process ID of the Vector instance.
pod_name optional
The name of the pod from which the data originated.
uri optional
The sanitized URI from which the data originated.

component_received_event_bytes_total

counter
The number of event bytes accepted by this component either from tagged origins like file and uri, or cumulatively from other origins.
component_id
The Vector component ID.
component_kind
The Vector component kind.
component_type
The Vector component type.
container_name optional
The name of the container from which the data originated.
file optional
The file from which the data originated.
host optional
The hostname of the system Vector is running on.
mode optional
The connection mode used by the component.
peer_addr optional
The IP from which the data originated.
peer_path optional
The pathname from which the data originated.
pid optional
The process ID of the Vector instance.
pod_name optional
The name of the pod from which the data originated.
uri optional
The sanitized URI from which the data originated.

component_received_events_count

histogram

A histogram of the number of events passed in each internal batch in Vector’s internal topology.

Note that this is separate than sink-level batching. It is mostly useful for low level debugging performance issues in Vector due to small internal batches.

component_id
The Vector component ID.
component_kind
The Vector component kind.
component_type
The Vector component type.
container_name optional
The name of the container from which the data originated.
file optional
The file from which the data originated.
host optional
The hostname of the system Vector is running on.
mode optional
The connection mode used by the component.
peer_addr optional
The IP from which the data originated.
peer_path optional
The pathname from which the data originated.
pid optional
The process ID of the Vector instance.
pod_name optional
The name of the pod from which the data originated.
uri optional
The sanitized URI from which the data originated.

component_received_events_total

counter
The number of events accepted by this component either from tagged origins like file and uri, or cumulatively from other origins.
component_id
The Vector component ID.
component_kind
The Vector component kind.
component_type
The Vector component type.
container_name optional
The name of the container from which the data originated.
file optional
The file from which the data originated.
host optional
The hostname of the system Vector is running on.
mode optional
The connection mode used by the component.
peer_addr optional
The IP from which the data originated.
peer_path optional
The pathname from which the data originated.
pid optional
The process ID of the Vector instance.
pod_name optional
The name of the pod from which the data originated.
uri optional
The sanitized URI from which the data originated.

component_sent_event_bytes_total

counter
The total number of event bytes emitted by this component.
component_id
The Vector component ID.
component_kind
The Vector component kind.
component_type
The Vector component type.
host optional
The hostname of the system Vector is running on.
output optional
The specific output of the component.
pid optional
The process ID of the Vector instance.

component_sent_events_total

counter
The total number of events emitted by this component.
component_id
The Vector component ID.
component_kind
The Vector component kind.
component_type
The Vector component type.
host optional
The hostname of the system Vector is running on.
output optional
The specific output of the component.
pid optional
The process ID of the Vector instance.

source_buffer_max_byte_size

gauge
The maximum number of bytes the source buffer can hold. The outputs of the source send data to this buffer.
Deprecated
This metric has been deprecated in favor of source_buffer_max_size_bytes.
component_id
The Vector component ID.
component_kind
The Vector component kind.
component_type
The Vector component type.
host optional
The hostname of the system Vector is running on.
output optional
The specific output of the component.
pid optional
The process ID of the Vector instance.

source_buffer_max_event_size

gauge
The maximum number of events the source buffer can hold. The outputs of the source send data to this buffer.
Deprecated
This metric has been deprecated in favor of source_buffer_max_size_events.
component_id
The Vector component ID.
component_kind
The Vector component kind.
component_type
The Vector component type.
host optional
The hostname of the system Vector is running on.
output optional
The specific output of the component.
pid optional
The process ID of the Vector instance.

source_buffer_max_size_bytes

gauge
The maximum number of bytes the source buffer can hold. The outputs of the source send data to this buffer.
component_id
The Vector component ID.
component_kind
The Vector component kind.
component_type
The Vector component type.
host optional
The hostname of the system Vector is running on.
output optional
The specific output of the component.
pid optional
The process ID of the Vector instance.

source_buffer_max_size_events

gauge
The maximum number of events the source buffer can hold. The outputs of the source send data to this buffer.
component_id
The Vector component ID.
component_kind
The Vector component kind.
component_type
The Vector component type.
host optional
The hostname of the system Vector is running on.
output optional
The specific output of the component.
pid optional
The process ID of the Vector instance.

source_buffer_utilization

histogram
The utilization level of the source buffer. The outputs of the source send data to this buffer.
component_id
The Vector component ID.
component_kind
The Vector component kind.
component_type
The Vector component type.
host optional
The hostname of the system Vector is running on.
output optional
The specific output of the component.
pid optional
The process ID of the Vector instance.

source_buffer_utilization_level

gauge
The current utilization level of the source buffer. The outputs of the source send data to this buffer.
component_id
The Vector component ID.
component_kind
The Vector component kind.
component_type
The Vector component type.
host optional
The hostname of the system Vector is running on.
output optional
The specific output of the component.
pid optional
The process ID of the Vector instance.

source_buffer_utilization_mean

gauge
The mean utilization level of the source buffer. The outputs of the source send data to this buffer. The mean utilization is smoothed over time using an exponentially weighted moving average (EWMA).
component_id
The Vector component ID.
component_kind
The Vector component kind.
component_type
The Vector component type.
host optional
The hostname of the system Vector is running on.
output optional
The specific output of the component.
pid optional
The process ID of the Vector instance.

source_lag_time_seconds

histogram
The difference between the timestamp recorded in each event and the time when it was ingested, expressed as fractional seconds.
component_id
The Vector component ID.
component_kind
The Vector component kind.
component_type
The Vector component type.
host optional
The hostname of the system Vector is running on.
pid optional
The process ID of the Vector instance.

How it works

Checkpointing

Vector checkpoints the current read position after each successful read. This ensures that Vector resumes where it left off if restarted, preventing data from being read twice. The checkpoint positions are stored in the data directory which is specified via the global data_dir option, but can be overridden via the data_dir option in the file source directly.

Context

By default, the windows_event_log source augments events with helpful context keys.

State

This component is stateful, meaning its behavior changes based on previous inputs (events). State is not preserved across restarts, therefore state-dependent behavior will reset between restarts and depend on the inputs (events) received since the most recent restart.