How to collect Windows Event Logs into Loki with Grafana Alloy
The supported path for getting Windows Event Log channels into self-hosted Loki is Grafana Alloy's loki.source.windowsevent component, which reads events from the Windows Event Log and forwards them to other Loki components in the same pipeline. Alloy runs on the Windows hosts themselves, so the first decision is which machines will run it, how it is installed and managed, and which account it runs under, since that account must be able to read the channels you select. Confirm the Alloy version you plan to standardize on against the current release notes before you write the configuration, because the component's options and defaults are the details most likely to change between releases. The Alloy reference for loki.source.windowsevent lists the arguments and the exact channel and query settings to review.
Do not plan around the Docker logging driver for Windows hosts. The Loki Docker driver is a Docker plugin, and Docker plugins are not supported on Windows, so containers running on Windows cannot ship logs through it. Container workloads on Windows need a different collection path, usually an Alloy agent on the host, and the choice should be made before the rollout rather than discovered during it. Treat this as a constraint on the architecture: every Windows node that hosts workloads you need to observe needs a collector that is installed and maintained like any other host agent.
Before you enable collection on a production estate, decide which channels matter for your investigations and which will produce volume you do not need. Security and System channels are common starting points, but the cost of ingesting them scales with event volume, so agree the channel list, the event filters and the label set with your security and operations teams first. Then test on a representative host, confirm that events arrive in Loki with the labels you planned, and check that the collecting account can read every channel you named. A missing permission produces no events and may produce no error, so the verification step is what proves the pipeline works.
What the Windows and Loki sides need before configuration
Collection fails quietly when either side is missing a prerequisite, so confirm the Loki side and the Windows side before editing any Alloy configuration. The cards below cover the endpoint, tenancy, host software, account rights and network path that connect a Windows host to Loki.
A reachable Loki write endpoint
Confirm the URL that Alloy will push to, and whether it points at Loki directly or at a load balancer or gateway in front of it. Check that the Windows hosts can resolve the name and reach the port over the expected protocol. Loki serves the push API on its HTTP listener, so a test push from a Windows host is the quickest proof that the path works before you add channels. Record the endpoint in your configuration standards so every host uses the same target.
Loki send data docsTenant header when auth is enabled
If Loki runs with auth_enabled set to true, every write must carry an X-Scope-OrgID header that names the tenant. Agree on the tenant ID for Windows logs with the team that owns the Loki cluster, and confirm that Alloy is configured to send it. A missing or wrong tenant header is rejected or lands in a tenant nobody queries, so treat it as a required setting, not an optional one.
Loki multi-tenancy docsAuthenticating proxy in front of Loki
Loki has no built-in authentication layer, so the documentation expects an authenticating reverse proxy such as nginx, HAProxy, OAuth2 Proxy or Pomerium in front of it. Confirm which proxy your organization runs, how Alloy will authenticate to it, and who owns its credentials. Plan the credential storage on the Windows hosts as well, since a secret in a plain configuration file is a common finding.
Loki authentication docsAlloy installed on Windows hosts
Alloy must be installed on each Windows host that will read Event Logs, and the installed version must match the loki.source.windowsevent component reference for the release you plan to run. Confirm the exact Alloy and Windows versions against that reference rather than assuming a combination works. Decide up front whether Alloy runs as a Windows service under a managed account, since that choice determines the rights in the next card.
Alloy windowsevent referenceRead rights on chosen Event Log channels
The account that runs Alloy must be allowed to read each channel you select, such as Security, System or Application, or a custom channel from an application. Security events are the most restricted, so confirm the account has the rights your security team approves, and do not grant broad administrative rights to make a test pass. Missing permissions can leave a channel empty without a clear error, so verify each channel with a sample read.
Firewall rules to the Loki endpoint
Open outbound access from each Windows host to the Loki write endpoint or the proxy in front of it, and allow only the port and protocol that endpoint uses. Include any DNS and proxy rules the hosts need to resolve and reach that address. Ask the network team to document the rule with source hosts, destination and owner, so changes to the endpoint do not silently stop log delivery across the fleet.
Configuring the windowsevent source step by step
This sequence takes a Windows host from confirmed connectivity to Loki through a running Alloy service, so that each Event Log channel you chose arrives in Grafana with a predictable channel label. Each step ends with a check you can run before moving on.
Confirm Loki reachability and tenant settings
Before touching the Windows host, confirm that the Windows machine can reach your Loki push endpoint over the network path your security team approved, and that the authenticating reverse proxy in front of Loki accepts the credentials Alloy will use. If auth_enabled is true, decide which tenant ID the Windows logs will use and confirm that it is sent in the X-Scope-OrgID header. Check reachability from a PowerShell session with Invoke-WebRequest against the proxy's health or ready path, and expect a successful response before proceeding. Ask your Loki operator to confirm the tenant ID and the credential format in writing.
Install Alloy as a Windows service
Install Grafana Alloy on the Windows host using the package or installer that matches your change process, then register it as a Windows service so it starts with the machine. Keep the default service account unless your policy requires a dedicated one, and note which account is used, because that account needs read access to the Event Log channels in the next steps. Place the configuration file in a directory that only administrators can write to. Confirm the service is installed by listing it with Get-Service and checking that its status is stopped, which is expected until the configuration exists.
Define the windowsevent source for chosen channels
Open the Alloy configuration file and add a loki.source.windowsevent block. Set the channels you selected in the locations argument, starting with Application, System and Security if your policy allows them, and keep the list short so that only channels with a clear owner are shipped. Set forward_to to a loki.write receiver that you will define in the next step. The component reads events from Windows Event Logs and passes them to other Loki components, so the forward_to wiring is what connects it to the writer. Validate the file with the Alloy validation command before restarting anything, and expect the command to report no errors.
Forward events to a loki.write component
Add a loki.write block that points to your Loki push endpoint and sets any authentication headers or tenant header your proxy requires. Make the loki.write receiver the target of the windowsevent source's forward_to argument. Keep the endpoint and credentials out of the main file by referencing a secret store or a protected file, and confirm the file permissions allow only the Alloy service account to read it. Validate the configuration again. A valid file with no syntax errors shows that the pipeline is wired, but it does not yet prove that events are being sent.
Set low-cardinality labels at the source
Attach a small set of static labels to the events in the pipeline, such as an environment label, a host or site label, and a job label that names the source. Use the channel name as a label only if it stays within a small, fixed set, because each distinct label combination creates a separate stream in Loki. Put detailed fields such as event ID, user or message text into the log line or structured metadata, not into labels. Document the label set for the team that will query it. Check the final configuration by reading it back and confirming no label carries values that change per event.
Start the service and check the restart
Restart the Alloy Windows service so it loads the new configuration, then check the service status and the Alloy log output for startup errors such as access denied on an Event Log channel or an unreachable push endpoint. An access denied message on the Security channel usually means the service account lacks the rights needed to read it, so fix the account rather than the configuration. Confirm the service is running and the Alloy log reports the source and writer as started. This step is complete when the service is running with no startup errors in its log.
Verify events arrive in Grafana
In Grafana, open Explore against the Loki data source for the tenant you configured and run a LogQL stream selector that matches the labels you set, such as the job label for the Windows host. Confirm that results appear and that the channel label shows the channel names you configured, for example Application, System or Security. Generate a known event, such as a test entry written to the Application log with Write-EventLog by an account with the right permission, and find it in the query results. The sequence is complete when the expected channel labels appear and the test event is visible.
Choosing Event Log channels and labels that keep Loki affordable
Start by deciding which channels earn a place in Loki. Most teams need the Application, System and Setup channels for operational troubleshooting, and the Security channel for detection and audit trails, but each channel should be justified by a named use: a失败 service investigation, a host health question, or an audit requirement your security team has written down. Ask the security team which event IDs their detections and investigations depend on, then ship only the channels that supply them. Forwarded events and other custom channels should be added the same way, one at a time, with a stated owner. Confirm the exact channel names on a representative host before writing the loki.source.windowsevent configuration, because channel names are what the component filters on.
The Security channel usually needs the most scrutiny. It records logon, privilege and object access events, so its volume depends heavily on how auditing is configured on the domain and on each server. Before you forward it, check which audit subcategories are enabled, estimate the event rate on a busy domain controller, and confirm who may read the stored events in Loki. Access to that data is a control in its own right, so plan tenant or access separation before the first host ships. Use the Loki multi-tenancy and access control guidance to decide whether security events need their own tenant. Loki's own retention settings should match the retention your audit policy requires, and the retention period is something to confirm with the policy owner rather than assume.
Keep stream labels to a small, stable set such as host, channel and environment, and possibly a job label that identifies the pipeline. Every distinct combination of labels creates a separate stream, so labels built from event IDs, user names, process names or IP addresses multiply stream counts quickly. Put event detail such as EventID, TargetUserName and LogonType in structured metadata or leave it in the log line, where LogQL can filter on it without creating new streams. The Loki labels and cardinality guidance explains the trade-offs in more depth. Before rollout, check the stream count for one host and one channel, and agree on the label set in writing so that new labels go through review.
Choosing between host-level Alloy and a central collector
Installing Alloy directly on every Windows server is the simplest model to reason about. Each host reads its own Event Log channels through loki.source.windowsevent and sends them to Loki with no intermediate hop. The trade-off is that every server now runs an agent with its own configuration, its own service account and its own upgrade cycle.
- Service account scope: The Alloy service needs read access to the channels it collects. Grant that through the minimum group membership or Event Log permissions your security team approves, and confirm the exact requirement in the component reference before you build the account.
- Patching load: Each agent version must be updated on every host, so your patch tooling and change records must cover Alloy as well as the operating system.
- Network paths: Each server needs its own outbound route to Loki, which may be simpler in a flat network but multiplies firewall rules in segmented environments.
- Filtering location: Channel and event filtering happens on the host, so noisy events never leave it, but policy changes must reach every machine.
Confirm with your Windows and security teams how the agent service account is provisioned and reviewed.
A central pattern places one or more Alloy or OpenTelemetry Collector instances between Windows hosts and Loki. Hosts forward events to the tier, which then writes to Loki. This concentrates configuration, egress and credentials, but it adds a component that must be sized, secured and monitored. Confirm the forwarding protocol and its authentication options in the Alloy component reference before you design the path, since this guide does not assume one.
- Concentrated configuration: Channel selection, labels and rate limits are maintained in one place rather than on each server.
- Fewer egress paths: Only the central tier needs a route to Loki, which simplifies firewall and proxy rules.
- Added failure point: An outage in the tier can stop collection for every host behind it, so plan redundancy and buffering.
- Trust boundary: Hosts must authenticate to the tier, and the tier must protect events in transit across the network segment between them.
Ask for the forwarding protocol, authentication method and buffering behavior in writing before you commit to this model.
Most organizations choose based on which constraints are hardest to change. Per-host agents fit small fleets, strong endpoint management and environments where each server has direct, approved egress. A central tier fits large fleets, segmented networks and teams that want one place to change label and filter policy. Neither option removes the need to decide which channels matter, so that decision should come first.
- Fleet size: Many hosts raise the cost of per-host configuration drift.
- Network segmentation: Restricted zones often favor a single approved egress path.
- Ownership: Decide whether the Windows team or the logging team owns agent configuration.
- Change control: Consider how quickly a filter change must reach every source.
Write down the chosen pattern and its owners before you draft the channel list, because labels and filters depend on it.
Whichever pattern you choose, the operating model determines whether collection stays correct over time. Per-host agents need fleet-level visibility into version and health. A central tier needs monitoring of its own throughput, backlog and errors, plus a clear recovery path. Both need a process for reviewing service accounts, since collection quietly stops if permissions change.
- Health visibility: Track agent status on every host or tier instance, not only on the destination.
- Version drift: Keep Alloy versions consistent across the fleet or document approved exceptions.
- Account reviews: Revalidate the read permissions after OS changes, group policy updates and account rotations.
- Recovery: Test how collection resumes after a host reboot or a tier restart.
- Documentation: Record where filtering happens so auditors can trace which events are dropped and why.
Before go-live, confirm with your team how a missing permission will be detected, because the agent may not report it as an error.
How Event Log fields map to Loki labels and log content
This table maps common Windows Event Log fields to Loki labels, structured metadata or log line content, and explains each choice. Labels define streams, so only fields with a small, bounded set of values belong there. Field names follow Windows XML naming, so confirm the exact field and label names the windowsevent component produces in its reference before you write pipeline rules.
| Field | Loki target | Reason | Confirm before building |
|---|---|---|---|
| Computer name | Host label | Small, bounded set that matches your fleet | Exact source field name and label key in the component reference |
| Channel (Security, System, Application) | Channel label | Few values, and queries usually start from a channel | Label key the component sets, and any channel names you add |
| Provider name | Structured metadata or log line | Many providers across channels; as a label it multiplies streams | Whether the component exposes it as metadata or only in the rendered message |
| Event ID | Structured metadata or log line | Hundreds of distinct IDs across providers; filter with LogQL | Whether the event ID is available as metadata or must be parsed from the line |
| Event record ID | Log line or structured metadata only | Increases with every event, so values are unbounded | Field name and whether it is emitted at all |
| Environment (for example prod or staging) | Static label | Set once in the Alloy configuration and stays fixed | Label key your query and retention rules expect |
| Owner or team | Static label | Keep to a short, agreed list of values | Label key and who maintains the list |
| Message text and EventData values | Log line content | Values vary per event, so search them with line filters | How the rendered message is formatted in your events |
| Time created, process ID and user SID | Log line or structured metadata only | Unique per event or session; labels would create excessive streams | Field names and whether the component keeps timestamps as event time |
How Windows events reach Grafana through Loki
The flow starts with Windows Event Log channels read by Grafana Alloy's loki.source.windowsevent component, which forwards entries to loki.write on the Windows network. Traffic then crosses the trust boundary to an authenticating reverse proxy, which must sit in front of Loki because Loki has no built-in authentication. When multi-tenancy is enabled, the X-Scope-OrgID header identifies the tenant on each request. Check the boundary, the proxy's authentication, and the tenant header before you trust the data in Grafana.
Windows Event Log data path from Alloy through a proxy into Loki and Grafana.
Securing the service account, transport and tenant access
Windows Event Logs often contain authentication and privilege data, so the path from the Windows host to Loki and then to Grafana needs controls at each hop. The cards below cover the read permissions Alloy needs, how the Security channel is protected, the proxy in front of Loki, and how tenants are kept apart.
Least-privilege channel access
Alloy only needs to read the channels you selected, so run it under an account that holds read rights on those channels and no administrative rights on the host. Windows grants access to the Security log through group membership and log-reader rights, so grant the minimum and record exactly which account was given which right. Confirm the access model with your Windows administrators before rollout, since changes to these rights often come from group policy and can be reverted by it.
Protecting Security channel content
The Security channel records logon events, privilege use and audit results, so treat its contents as sensitive from the moment Alloy reads it. Decide who in your organization may query those streams in Grafana, and restrict the Security channel to a dedicated tenant or stream selector if your access model requires it. Confirm which fields your privacy team considers personal data before you forward them.
Running Alloy under a managed service account
A managed or group-based service account lets you rotate credentials without editing the Alloy service on every host. Avoid running Alloy as an interactive user or a shared administrator account, because a password change or a logged-off session can silently stop collection. Ask your identity team which account type they support and how its password and lifecycle are managed.
Encrypting transport through the proxy
Loki has no built-in authentication, so it must sit behind an authenticating reverse proxy such as nginx, HAProxy, OAuth2 Proxy or Pomerium, as the Loki authentication documentation requires. Terminate TLS at that proxy, and configure Alloy to send to the proxy address over TLS with credentials it is allowed to use. Confirm the certificate chain and the Alloy trust store on each Windows host before go-live.
Loki authentication docsEnforcing tenant isolation
When auth_enabled is true, Loki reads the X-Scope-OrgID header on every request to select a tenant. Set the header in Alloy for each Windows source, and have the proxy overwrite any client-supplied tenant value so that a host cannot write into another team's tenant. Test isolation by querying one tenant with another tenant's credentials and confirming that no results return.
Loki multi-tenancy docsConfirming label-based access needs
Label-based access control, which limits what a user can read by stream label, is a Grafana Enterprise Logs feature rather than part of open-source Loki. If you need per-channel or per-host read restrictions inside one tenant, confirm that requirement against the Grafana Enterprise Logs documentation and your compliance obligations before you design the tenant layout. With open-source Loki, your practical boundary is the tenant and the proxy in front of it.
Enterprise Logs docsWhy Windows events are missing or arrive unlabeled
This table pairs each common failure with its likely cause and fix when Windows events do not reach Loki or arrive with the wrong labels. Start by checking the Alloy component health output, which usually names the failing channel or permission before you change anything else. Work down the rows in order, since a service account or tenant problem can hide every other symptom.
| Symptom | Likely cause | Fix |
|---|---|---|
| No events for a channel | The account running Alloy lacks read rights for that channel, often Security | Grant the Alloy service account read access to the channel, then restart the component and confirm events flow |
| Component reports a channel not found | The channel name is misspelled or is an application-specific log that is not installed on this host | List channel names on the host and match them exactly in the component configuration, including case and spaces |
| Events collected, but none in Loki | Alloy runs under a different account than the one you tested with, such as Local System instead of a service account | Check the account on the Alloy service entry and align permissions with that account, not your interactive login |
| Loki rejects pushes | Multi-tenancy is on (auth_enabled true) and the X-Scope-OrgID header is missing from the write path | Set the tenant header in the Alloy Loki writer configuration and confirm the tenant ID exists in your limits |
| Label cardinality grows fast | Fields such as event record ID, process ID or full message text were promoted to labels | Keep labels to stable values such as host, channel and provider, and move per-event fields to structured metadata or line content |
| Timestamps look shifted or out of order | The Windows host clock or time zone differs from the reference time used by your Loki and Grafana queries | Verify NTP sync on Windows hosts and compare event times with a known reference, then correct the host before re-collecting |
| Some hosts unlabeled or mislabeled | Host or channel label values are not set in the component, so defaults or blank values apply | Add explicit labels for host and channel in the component configuration and test one host before rolling out |
Questions buyers ask before outsourcing Windows log collection
Can our in-house team collect Windows Event Logs into Loki without a partner?
Yes, a team with Windows administration and Loki experience can do this in-house, and many do. The work is the Alloy configuration, a service account with read access to the channels, a network path from the hosts to Loki, and label decisions that stay stable over time. The harder part is usually repeating that work safely across many hosts, change windows and a Loki cluster that other teams also use. Decide whether your team has spare capacity for the rollout and for ongoing tuning of channels and labels, then compare that against a fixed-scope engagement with written deliverables.
What drives the effort in a Windows Event Log collection project?
Effort follows the design decisions more than the raw host count. The main drivers are:
- The number of hosts and how many Windows builds, roles and domains they span
- The channels you collect, such as Security, System, Application and any application-specific logs
- Labeling decisions, since label choices affect query speed and cost in Loki
- Proxy and tenancy design, including how the Loki endpoint sits behind an authenticating reverse proxy and which
X-Scope-OrgIDvalues each team uses
Each of these adds review, testing and documentation work, so ask the provider to list them separately in the quote.
How long does Windows log collection take for a small versus a large estate?
Duration depends on estate size, channel count, the number of distinct label sets, and how many approvals and change windows your organization requires. A small estate with a few channels and an existing Loki endpoint usually moves faster than a large domain with several business units, separate tenants and strict change control. Ask for a timeline that separates design, a pilot on a small host group, staged rollout, and verification, and ask which steps depend on your teams, such as firewall changes or service account approvals. No fixed duration can be given before the scope is known.
What must we provide before Windows log collection starts?
Plan to provide the inputs the work cannot proceed without:
- Administrative access to the Windows hosts, or a change process that lets the provider's engineers deploy and verify Alloy
- A reachable, supported Loki endpoint and the tenant or organization ID to use
- A service account with rights to read the chosen event channels
- Change windows, approval contacts and a named owner for each host group
Confirm these with your Windows, network and security teams early, because access and approvals often set the schedule more than the technical build does.
Can we use the Docker logging driver to send Windows container logs to Loki?
No. Docker plugins, including the Loki Docker driver, are not supported on Windows, so that driver cannot be used on Windows hosts. For Windows hosts, use Grafana Alloy with the loki.source.windowsevent component to read Windows Event Log channels. If you run Windows containers and need their logs, confirm with the Loki documentation for the Docker driver and with your container platform how those logs can be collected, and plan that collection separately from the event log work.
Does DeployOpen issue compliance attestations for Windows log collection?
No. DeployOpen prepares systems, controls and evidence for compliance assessments, but independent auditors and certification bodies issue audit reports, attestations and certifications. For Windows log collection, that evidence can include documented channel selection, retention settings in Loki, tenant separation, access controls in front of Loki and test results showing that events arrive as designed. Ask your auditor which evidence they expect before the build starts so the design can produce it.
What should a written scope quote for Windows log collection include?
A quote follows from a written scope, and DeployOpen does not publish a price list. Ask for the list of hosts and host groups in scope, the channels to collect, the label model, the Loki and reverse proxy changes included, the pilot and rollout plan, the verification steps, the documentation handed over and what is excluded. Also ask which costs are one-time, such as design and rollout, and which recur, such as retainer support or channel changes. Compare quotes on that list rather than on total figures alone.
Where to confirm component options and Loki requirements
Start with the Alloy reference for loki.source.windowsevent before you write any configuration, because the component's arguments, the event channel and XPath query settings, and the labels it attaches to each entry are the details that change between releases. The reference is the authoritative source for what the component reads and how it forwards events to other Alloy components, so treat any example you find elsewhere, including the one in this guide, as a starting point to be checked against it. Note which Alloy version the reference describes and compare it with the version you plan to deploy. Pin that version in your deployment manifests so the configuration you test is the configuration that reaches production.
The Loki Docker driver client page matters for one reason here: it confirms that Docker plugins, including the Loki Docker driver, are not supported on Windows. Read it only to confirm that limitation, so you do not spend time trying to ship Windows container or host logs through the driver. Windows hosts that run containers should send their logs through Alloy, and the decision about which container log path to use belongs in the sibling topic on Docker container logs.
Before deployment, read the current Alloy and Loki release notes for changes to the Windows event component, to the Loki endpoints it writes to, and to any deprecation notices affecting your version pair. Confirm the Windows Server and Windows client versions you intend to support against the vendor documentation for both Alloy and Windows itself, since support statements can differ from what works in a lab. Ask your Loki and Alloy support contacts, or your DeployOpen engagement lead, to record the exact versions in the design document so that the verification plan tests the same stack that will run in production.
How DeployOpen works on this
DeployOpen plans and delivers Windows Event Log collection into self-hosted Loki inside your own infrastructure, starting with a written scope that names the channels, label design and Grafana access you need. The work is fixed-scope, so the channels, deliverables and timelines are agreed in writing before the build begins.
How we scope
- Inventory the Windows Event Log channels your security and operations teams need, such as Security, System and Application.
- Agree which event fields become Loki labels and which stay in the log line to limit cardinality.
- Confirm the Windows host groups, Alloy deployment method and Loki tenant IDs in the written scope.
How we build
- Configure loki.source.windowsevent blocks on test hosts, then forward events through Alloy to your Loki write path.
- Verify that events arrive with the expected labels, timestamps and channel names before any production rollout.
- Document the Alloy configuration, service account permissions and the Docker logging driver limitation on Windows hosts.
How we hand over
- Deliver versioned Alloy configuration files, a host rollout runbook and a list of the channels collected.
- Walk your operations team through checking ingestion, troubleshooting missing events and changing channel selections.
- Provide a written record of the label schema and retention settings applied to Windows log streams.
How we support
- Offer ongoing support, upgrades and continuous testing for the Windows collection setup as a retainer.
- Review Alloy version changes and Loki release notes against your Windows collection configuration when upgrades are planned.
- Ask for a quote based on the written scope, including host count, channel list and tenant design.

