An open-source agent built for reading parsing Windows Event logs and sending them to a syslog server.
A little while ago, I wanted to build a centralized logging server that would collect and process all of the logs from Windows and Linux servers. Rsyslog seems to be one of the best solutions when it comes to this.
They have a Windows Agent on their site, but it's not like the Linux version of the program. I wanted to make something like that for Windows, so this is what I came up with.
When building this, I wanted it to be:
- Fast
- Lightweight
- Configurable
- Open-source
This project was written and tested using Java 8, you will need to have it installed if you want to run the project. It might work on other versions of Java but I cannot guarantee that.
There are two ways you can get the jar file, you can:
- Download the latest build from the releases page.
- Build the jar file yourself, clone the repository and run:
gradlew.bat shadowJar
Once you build or download the jar file, you can run it using:
java -jar SyslogAgent.jarUpon startup, a config.json file will be created in the folder with the jar file.
It should look something like this:
{
"timeBetweenReads": 10000,
"host": {
"protocol": "UDP",
"address": "127.0.0.1",
"port": 514
},
"sources": [ "Application", "Security" ],
"filters": [
{
"source": "Application",
"filter": "Simple",
"options": {
"levels": [ "Warning", "Error" ]
}
},
{
"source": "Security",
"filter": "Security Logins",
"options": {}
}
]
}Here is an explaination of what is going on:
timeBetweenReadsis how frequent we access the Event Logs (in milliseconds)hostis the syslog server that messages will be forwarded to:UDPis the only protocol currently supportedTCPwill be supported in the future (hopefully)
sourcesare the Event Logs we want to readfiltersis a list of filters:sourceis one of the sources we specifiedfilteris the type of filter (See the list of filters below)optionsare the options for that filter
Filter types:
Simplewill filter based on the provided logging levelsSecurity Loginswill send messages when a user logs in or logs out