# Better Stack Windows logging


## Start logging in 2 minutes

Collect logs and metrics from your Windows server using [Vector](https://vector.dev/).

### 1. Install Vector

Run in PowerShell as administrator:

```powershell
[label Install Vector]
Invoke-WebRequest https://packages.timber.io/vector/latest/vector-x64.msi -OutFile vector-latest-x64.msi
Start-Process msiexec.exe -ArgumentList "/i", "vector-latest-x64.msi", "/passive" -Wait
```

### 2. Download Vector configuration

```powershell
[label Download Vector config]
$config_yaml_path = "C:\Program Files\Vector\config\vector.yaml"
$backup_path = "C:\Program Files\Vector\config\vector-backup.yaml"
Move-Item -Path "$config_yaml_path" -Destination "$backup_path" -Force
$docker_present = if ((Get-Command docker -ErrorAction SilentlyContinue) -and (docker info 2>$null)) { "true" } else { "false" }
Invoke-RestMethod -Uri "https://telemetry.betterstack.com/vector-yaml/windows/$SOURCE_TOKEN?docker=$docker_present" |
  Set-Content $config_yaml_path
```

[info]
#### What does the configuration collect?

- The System and Application channels of the Windows Event Log.
- Host metrics such as CPU, memory, disk and network.
- Logs of PostgreSQL, MySQL, MongoDB, Apache and Nginx from their default Windows locations. Adjust the paths in `vector.yaml` if your logs live elsewhere.
- Docker container logs and stats when Docker is running.
[/info]

### 3. Run Vector

Install Vector as a Windows service and start it:

```powershell
[label Start Vector]
& "C:\Program Files\Vector\bin\vector" service install --config "C:\Program Files\Vector\config\vector.yaml"
& "C:\Program Files\Vector\bin\vector" service start
```

You should see your logs in [Better Stack → Live tail](https://telemetry.betterstack.com/team/0/tail ";_blank").

## Need help?

Please let us know at hello@betterstack.com.  
We're happy to help! 🙏

## Additional information

#### Changed the configuration?

Restart the service to apply it:

```powershell
[label Restart Vector]
& "C:\Program Files\Vector\bin\vector" service restart
```

#### Looking for manual instructions to set up Vector?

Find step-by-step instructions in our [dedicated Vector guide](https://betterstack.com/docs/logs/vector/#set-up-vector-manually).
