Page cover

SC4S Custom Filter For Windows Event Log in Syslog Format (NXLog)

Here are the repo contain an example of a custom filter I made for this Windows Event Log in Syslog Format

Why am I sending Windows Event Log in Syslog Format? πŸ˜‚

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πŸ˜‚.

Overview Topology

This is the same as the Splunk Test Lab I made, so you can see the SC4S container and the NXLog

The setup

  • 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

About the nxlog configuration file, you have to read the documentation for configuration on your own. I use this configuration line to convert logs to JSON and wrap it with Syslog format:

Exec $Message = to_json(); to_syslog_bsd();

Nxlog Documentation: https://docs.nxlog.co/userguide/integrate/windows-eventlog.html#forwarding-windows-logs-in-json-format

Log example: this is BSD Syslog Format

What is SC4S and how to create a custom Parser/Filter?

SC4S is Splunk Connect for Syslog, a Syslog intermediate for Splunk that parses and indexes some known vendor products using Syslog.

πŸ˜• 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

sc4s:fallback is when you don't have a parser or a filter for that type of log, product, or vendor, and most likely you will have to develop or create one for that

Where to create an SC4S custom parser?

You navigate to /opt/sc4s/config/app_parser/syslog/

This folder is where SC4S stores your custom parser configuration

On the SC4S GitHub repo: https://github.com/splunk/splunk-connect-for-syslog/tree/main/package/etc/conf.d/conflib this store the built-in parser/filter configuration of SC4S (which is very useful to use this repo as a guideline or configuration reference)


Sharing my experience

  • The configuration file I made

  • How do I approach this

  • Takeaway and my to-do

The Configuration File

The JSON configration file

Or Xml Configration file which I'll never get to use

How do I approach this?

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

Takeaway and my to-do

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

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)

  • 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)

About Syslog Format

There are 3 type of Syslog Format:

  • BSD

  • IETF

  • Snare

Conclusion

Fun ride, please future developer or god of technology please make the all the format in one or create a god parser or something πŸ˜‚

Last updated

Was this helpful?