[id="{beatname_lc}-installation-configuration"]
== {beatname_uc} quick start: installation and configuration

++++
<titleabbrev>Quick start: installation and configuration</titleabbrev>
++++

This guide describes how to get started quickly with Windows log monitoring.
You'll learn how to:

* install {beatname_uc} on each system you want to monitor
* specify the location of your log files
* parse log data into fields and send it to {es}
* visualize the log data in {kib}

[role="screenshot"]
image::./images/winlogbeat-dashboard.png[{beatname_uc} dashboard]

[float]
=== Before you begin

You need {es} for storing and searching your data, and {kib} for visualizing and
managing it.

include::{libbeat-dir}/tab-widgets/spinup-stack-widget.asciidoc[]

[float]
[[installation]]
=== Step 1: Install {beatname_uc}

. Download the {beatname_uc} zip file from the
https://www.elastic.co/downloads/beats/winlogbeat[downloads page].
. Extract the contents into `C:\Program Files`.
. Rename the `winlogbeat-<version>` directory to `Winlogbeat`.
. Open a PowerShell prompt as an Administrator (right-click on the PowerShell
icon and select Run As Administrator).
. From the PowerShell prompt, run the following commands to install the service.

["source","sh",subs="attributes,callouts"]
----
PS C:\Users\Administrator> cd 'C:\Program Files\Winlogbeat'
PS C:\Program Files\Winlogbeat> .\install-service-winlogbeat.ps1

Security warning
Run only scripts that you trust. While scripts from the internet can be useful,
this script can potentially harm your computer. If you trust this script, use
the Unblock-File cmdlet to allow the script to run without this warning message.
Do you want to run C:\Program Files\Winlogbeat\install-service-winlogbeat.ps1?
[D] Do not run  [R] Run once  [S] Suspend  [?] Help (default is "D"): R

Status   Name               DisplayName
------   ----               -----------
Stopped  winlogbeat         winlogbeat
----

NOTE: If script execution is disabled on your system, you need to set the
execution policy for the current session to allow the script to run. For example:
`PowerShell.exe -ExecutionPolicy UnRestricted -File .\install-service-winlogbeat.ps1`.

NOTE: To use a local non-Administrator account to run Winlogbeat, follow <<local-user-account-setup,these additional steps>>.

[float]
[[set-connection]]
=== Step 2: Connect to the {stack}

include::{libbeat-dir}/shared/connecting-to-es.asciidoc[]

[float]
[[configuration]]
=== Step 3: Configure {beatname_uc}

In `winlogbeat.yml`, configure the event logs that you want to monitor.

. Under `winlogbeat.event_log`, specify a list of event logs to monitor. By
default, {beatname_uc} monitors application, security, and system logs.
+
[source,yaml]
----
winlogbeat.event_logs:
  - name: Application
  - name: Security
  - name: System
----
+
To obtain a list of available event logs, run `Get-EventLog *` in PowerShell.
For more information about this command, see the configuration details for
<<configuration-winlogbeat-options-event_logs-name,event_logs.name>>.

. (Optional) Set logging options to write Winlogbeat logs to a file:
+
[source,yaml]
----
logging.to_files: true
logging.files:
  path: C:\ProgramData\winlogbeat\Logs
logging.level: info
----

. After you save your configuration file, test it with the following command.
+
[source,shell]
----
PS C:\Program Files\Winlogbeat> .\winlogbeat.exe test config -c .\winlogbeat.yml -e
----


For more information about configuring {beatname_uc}, also see:

* <<configuring-howto-{beatname_lc},Configure {beatname_uc}>>
* {beats-ref}/config-file-format.html[Config file format]
ifeval::["{beatname_lc}"!="apm-server"]
* <<{beatname_lc}-reference-yml,+{beatname_lc}.reference.yml+>>: This reference configuration
file shows all non-deprecated options. You'll find it in the same location as
+{beatname_lc}.yml+.

[float]
[[setup-assets]]
=== Step 4: Set up assets

{beatname_uc} comes with predefined assets for parsing, indexing, and
visualizing your data. To load these assets:

. Make sure the user specified in +{beatname_lc}.yml+ is
<<privileges-to-setup-beats,authorized to set up {beatname_uc}>>.

. From the installation directory, run:
+
--
include::{libbeat-dir}/tab-widgets/setup.asciidoc[tag=win]
--

This step loads the recommended {ref}/index-templates.html[index template] for writing to {es}
and deploys the sample dashboards for visualizing the data in {kib}.

[TIP]
=====
A connection to {es} (or {ess}) is required to set up the initial
environment. If you're using a different output, such as {ls}, see
<<load-template-manually>> and <<load-kibana-dashboards>>.
=====

[float]
[[start]]
=== Step 5: Start {beatname_uc}

Before starting {beatname_uc}, modify the user credentials in
+{beatname_lc}.yml+ and specify a user who is
<<privileges-to-publish-events,authorized to publish events>>.

To start the {beatname_uc} service, run:

// tag::start-step[]
[source,shell]
----------------------------------------------------------------------
PS C:\Program Files\Winlogbeat> Start-Service winlogbeat
----------------------------------------------------------------------

{beatname_uc} should now be running. If you used the logging configuration
described here, you can view the log file at
`C:\ProgramData\winlogbeat\Logs\winlogbeat`.

You can view the status of the service and control it from the Services
management console in Windows. To launch the management console, run
this command:

[source,shell]
----------------------------------------------------------------------
PS C:\Program Files\Winlogbeat> services.msc
----------------------------------------------------------------------
// end::start-step[]

[float]
==== Stop {beatname_uc}

Stop the {beatname_uc} service with the following command:

[source,shell]
----------------------------------------------------------------------
PS C:\Program Files\Winlogbeat> Stop-Service winlogbeat
----------------------------------------------------------------------

[float]
[[view-data]]
=== Step 6: View your data in {kib}

include::{libbeat-dir}/shared/opendashboards.asciidoc[tag=open-dashboards-intro]

include::{libbeat-dir}/shared/opendashboards.asciidoc[tag=open-dashboards]

[float]
[[local-user-account-setup]]
=== Using a local non-Administrator account to run Winlogbeat

By default, the +{beatname_uc}+ service runs as the `Local System` account. 
If you want to run the +{beatname_uc}+ service as a local user account 
that is not an Administrator, then follow the steps below. The local user account 
must be granted `Log on as a service` in the security policy 
and be made part of the `Builtin\Event Log Readers` group to read the event log. 

. Open the Services Management console with this command:
+
[source,shell]
----------------------------------------------------------------------
PS C:\Program Files\Winlogbeat> services.msc
----------------------------------------------------------------------
+
. Right-click on service named +{beatname_lc}+ and select `Properties`
. Under `Log On` tab, select `This account:` and browse for the local account user 
that you want to run {beatname_uc} service as.
. Enter local user account's password and click `Apply`.
. Search and open `Local Group Policy Editor` in Windows search or 
run `gpedit.msc` from Powershell.
. Navigate to path: `Computer Settings → Security Settings → Local Policies` 
and open `User Rights Assignment` under it.
. Inside `User Rights Assignment`, add your local user account to the policy named 
`Log on as a service`. This should allow your local user account log on as a service.
. Open `Local Users and Group Manager` by running `lusrmgr.msc` in Powershell.
. Under `Users`, right-click on your local account user and open `Properties`.
. Select `Member of` tab and click on `Add...`
. Find and select the group named `Event Log Readers` and click `Apply`. 
This should allow your local account user to read the event log.

[float]
=== What's next?

Now that you have your logs streaming into {es}, learn how to unify your logs,
metrics, uptime, and application performance data.

include::{libbeat-dir}/shared/obs-apps.asciidoc[]
