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!

Built-in Service Level Objectives Management to Bridge the Gap Between Service & ...

Wednesday, May 29, 2024  |  11AM PST / 2PM ESTRegister now and join us to learn more about how you can ...

Get Your Exclusive Splunk Certified Cybersecurity Defense Engineer Certification at ...

We’re excited to announce a new Splunk certification exam being released at .conf24! If you’re headed to Vegas ...

Share Your Ideas & Meet the Lantern team at .Conf! Plus All of This Month’s New ...

Splunk Lantern is Splunk’s customer success center that provides advice from Splunk experts on valuable data ...