SC4S Custom Filter For Windows Event Log in Syslog Format (NXLog)
Last updated
Was this helpful?
Last updated
Was this helpful?
Because I can, long story short, my use case or company policy or requirement doesn't want me to use Splunk UF to act as an intermediate forwarder to forward Windows Event Logs but wants Windows Machine to send logs using nxlog and deliver logs in Syslog format. So here we are sending Windows Event Log in Syslog format.
I'm using NXLog CE to forward logs from the Windows endpoint
By using NXLog I convert Windows Event Logs into JSON after that I wrap it with Syslog Format
Log example: this is BSD Syslog Format
SC4S is Splunk Connect for Syslog, a Syslog intermediate for Splunk that parses and indexes some known vendor products using Syslog.
You navigate to /opt/sc4s/config/app_parser/syslog/
This folder is where SC4S stores your custom parser configuration
The configuration file I made
How do I approach this
Takeaway and my to-do
The JSON configration file
Or Xml Configration file which I'll never get to use
In the beginning, I didn't know how to do this because the documentation was quite limited, but luckily the open source SC4S so I can take a look at their code and find out how they create a parser and hopefully I can't reverse engineer the process and create one of my own.
Reading Reddit post and their GitHub repo helps a lot -> found out create a custom parser is a normal thing in SC4S -> now I know I can do it
Copy other parser configurations and testing them using the local lab is super helpful -> I create a guide repo for you to create an SC4S test lab above
Because the NXLog Windows Event Log Schema is different from Splunk UF and I also create different source types for the Windows Event Log in Json via Syslog
There are like 3 field that are different
Also sending windows event log in JSON is fine but if you want to leverage the CIM, I think I should send it in XML rather than JSON (Only support in NXLog EE)
Aug 11 2023
---
NXLog has a different schema -> changing the source type will not help and sending it using XML format will also not help because of NXLog, the only way is that you have a transformer between the NXLog and the Splunk (right now is sc4s -> but it is not going to do a great job to act as a Transformer)
The alternative solution could be Cribl Stream as an SC4S replacement (because it can parse and transform logs) or you buy the NXLog EE -> which will allow you to do Splunk Windows Event Log schema
There are 3 type of Syslog Format:
BSD
IETF
Snare
This is the same as the I made, so you can see the SC4S container and the NXLog
Nxlog Documentation:
The question is if you have a custom application that is using Syslog and you want to support it then now what, or does your SC4S keep sending you event sc4s:fallback
On the SC4S GitHub repo: this store the built-in parser/filter configuration of SC4S (which is very useful to use this repo as a guideline or configuration reference)
Because I named the sourcetype is os_win_syslog -> the log I forwarded is not CIM compatible (Not only the sourcetype is the only problem)-> So it is not good because in Splunk world CIM Compatible is everything (it normalize everything and make a standard in Splunk)
Fun ride, please future developer or god of technology please make the all the format in one or create a god parser or something