Best Lightweight Syslog Receiver for Quick Debugging on Windows?

0
0
Asked By ChillPanda99 On

I'm looking for a lightweight way to collect syslog data temporarily, preferably something that can run on Windows without needing installation. The main goal is to just dump the syslog input into a file. Any suggestions?

1 Answer

Answered By PowerShellDude22 On

You can use PowerShell to set up a listener that captures syslog data and saves it to a file. Here's a quick script you can try:

```powershell
$port = 514
$logfile = "C:Tempsyslog_capture.log"
$logdir = Split-Path $logfile
if (!(Test-Path $logdir)) { New-Item -ItemType Directory -Path $logdir | Out-Null }
$udp = New-Object System.Net.Sockets.UdpClient($port)
Write-Host "Listening on UDP port $port... Logging to $logfile"
while ($true)
{
$remote = New-Object System.Net.IPEndPoint([System.Net.IPAddress]::Any, 0)
$bytes = $udp.Receive([ref]$remote)
$message = [System.Text.Encoding]::UTF8.GetString($bytes)
$line = "[$($remote.Address):$($remote.Port)] $message"
Write-Host $line
Add-Content -Path $logfile -Value $line
}
```
Give it a shot!

DebuggingNinja75 -

That looks like exactly what I need. Thank you!

Related Questions

LEAVE A REPLY

Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.