Reporting

Programming business rules inside Splunk

fduprat
Explorer

Is it possible to program some special consolidation inside Splunk?

For example: I want to run trough all log lines, ordered by id_user and date. For each 30 minutes a user navigate on my site, I count one visitor session, except for IPs inside a black list.

Is Splunk made for it?

Tags (1)

fox
Path Finder

have a try with: summary indexing and search macros

0 Karma

southeringtonp
Motivator

Splunk is pretty flexible. Take a look at lookup tables and custom search commands.

Lookup tables allow you to add new fields based on existing ones. Typically you'll use a CSV file, but you can also us custom Python code. Take a look at the earlier question about Using CIDR in a lookup table for more ideas.

Custom search commands allow you to take things further, and process search results almost any way you want. Again, these would be written in Python. For more information, look here and here.

For your example case, a lookup is the way to go. If you are blacklisting individual IP addresses, create a CSV-based lookup with two fields src_ip and blacklisted, then search for, e.g., blacklisted=1. If you want to use network ranges instead, try the subnet lookup script referenced here or use eventtypes.

netwrkr
Communicator

Splunk can do just about anything provided you know how to write the search query. Take a look at the 'transaction' command - I believe it is what you seek -

http://www.splunk.com/base/Documentation/latest/SearchReference/Transaction

0 Karma

fduprat
Explorer

This works fine, but I must always use that query-like structure inside Splunk?

Can I do some kink of structured programming inside Splunk?

Can I use Java inside Splunk?

0 Karma

fduprat
Explorer

Thank you! I will take a look.

0 Karma
Got questions? Get answers!

Join the Splunk Community Slack to learn, troubleshoot, and make connections with fellow Splunk practitioners in real time!

Meet up IRL or virtually!

Join Splunk User Groups to connect and learn in-person by region or remotely by topic or industry.

Get Updates on the Splunk Community!

Modernize your Splunk Apps – Introducing Python 3.13 in Splunk

We are excited to announce that the upcoming releases of Splunk Enterprise 10.2.x and Splunk Cloud Platform ...

Step into “Hunt the Insider: An Splunk ES Premier Mystery” to catch a cybercriminal ...

After a whole week of being on call, you fell asleep on your keyboard, and you hit a sequence of buttons that ...

SplunkTrust Application Period is Officially OPEN!

It's that time, folks! The application/nomination period for the 2026-2027 SplunkTrust is officially open. If ...