Dashboards & Visualizations

dynamic index assignment based on event or log prefix

dhavamanis
Builder

We do have the sample event like below and these event logs are coming from syslog-ng forwarder. Can you please tell us, how to assign the index based on event prefix value.

Example Event :

nbcutve bal-8080 1.2.3.4 - - [11/Aug/2014:15:10:04 +0000] "GET http://test.com HTTP/1.1"
nbcubravo bal-8079 1.2.3.5 - - [11/Aug/2014:15:10:04 +0000] "GET http://test.com HTTP/1.1"
nbcubravo bal-6339 1.2.3.6 - - [11/Aug/2014:15:10:04 +0000] "GET http://test.com HTTP/1.1"
nbcubravo bal-6339 1.2.3.7 - - [11/Aug/2014:15:10:04 +0000] "GET http://test.com HTTP/1.1"
nbcutve bal-8079 1.2.3.4 - - [11/Aug/2014:15:10:04 +0000] "GET http://test.com HTTP/1.1"

In the above example, nbcutve and nbcubravo are the different brand, how to assign different brand name to appropriate index name (nbcutve / nbcubravo ) dynamically in transform.conf and inputs.conf. Can you please share the config details.

Another Example logs : (please provide REGEX for the below pattern prefix extraction as well)

nbcutve.varnishncsa bal-8080 1.2.3.4 - - [11/Aug/2014:15:10:04 +0000] "GET http://test.com HTTP/1.1"
nbcubravo.varnishncsa bal-8079 1.2.3.5 - - [11/Aug/2014:15:10:04 +0000] "GET http://test.com HTTP/1.1"
nbcubravo.varnishncsa bal-6339 1.2.3.6 - - [11/Aug/2014:15:10:04 +0000] "GET http://test.com HTTP/1.1"
nbcubravo.varnishncsa bal-6339 1.2.3.7 - - [11/Aug/2014:15:10:04 +0000] "GET http://test.com HTTP/1.1"
nbcutve.varnishncsa bal-8079 1.2.3.4 - - [11/Aug/2014:15:10:04 +0000] "GET http://test.com HTTP/1.1"
Tags (2)
1 Solution

somesoni2
Revered Legend

Try something like this

On Indexer
props.conf

[YourSourceType]
..
..
TRANSFORMS-idx_assign = assign_idx


transforms.conf

[assign_idx]
DEST_KEY = _MetaData:Index
REGEX = ^(\w*)(\s|\.)
FORMAT = $1

Need a restart after updated the conf files

View solution in original post

somesoni2
Revered Legend

Try something like this

On Indexer
props.conf

[YourSourceType]
..
..
TRANSFORMS-idx_assign = assign_idx


transforms.conf

[assign_idx]
DEST_KEY = _MetaData:Index
REGEX = ^(\w*)(\s|\.)
FORMAT = $1

Need a restart after updated the conf files

Get Updates on the Splunk Community!

Threat Hunting Unlocked: How to Uplevel Your Threat Hunting With the PEAK Framework ...

WATCH NOWAs AI starts tackling low level alerts, it's more critical than ever to uplevel your threat hunting ...

Splunk APM: New Product Features + Community Office Hours Recap!

Howdy Splunk Community! Over the past few months, we’ve had a lot going on in the world of Splunk Application ...

Index This | Forward, I’m heavy; backward, I’m not. What am I?

April 2024 Edition Hayyy Splunk Education Enthusiasts and the Eternally Curious!  We’re back with another ...