Getting Data In

Routing Data to specific index based on filename

mookiie2005
Communicator

We need to route data to specific indexes based on the file names being monitored. We are trying to get the data from the file(s) /app_qa/vodn_01/logfiles/current/bipc9996.stdout to route to the index named "RATABASE_SIT2" With our current settings all of this data is going to index "main" We have several other files that need to be routed accordingly, we are just looking for a good example we can use.

inputs.conf:
[monitor:///app_qa/vodn_01/logfiles/current/.]
followSymlink=true
crcSalt =

props:
[source::bipc9996.stdout]
TRANSFORMS-routing_SIT2_bipc9996 = index_redirect_to_RATABASE_SIT2_bipc9996

transforms:
[index_redirect_to_RATABASE_SIT2_bipc9996]
REGEX = bipc9996.stdout
sourcetype = bipc9996_SIT2
DEST_KEY = _MetaData:Index
FORMAT = RATABASE_SIT2

we assume these files (props/transforms) should be in the etc/app/local folder on the deployment server/forwarder. We have also deployed these changes to the indexer. Is this setup incorrect?

0 Karma
1 Solution

Ayn
Legend

Easiest thing would be to set the correct index directly in inputs.conf on the forwarder.

[monitor:///app_qa/vodn_01/logfiles/current/bipc9996.stdout]
index = RATABASE_SIT2
...

Otherwise if you don't want that for some reason, this can be done almost like what you've pasted but NOT on the forwarders - it needs to go on the full Splunk instance that performs parsing of the logs, which is often your indexers.

props.conf:

[source::/app_qa/vodn_01/logfiles/current/bipc9996.stdout]
TRANSFORMS-routing_SIT2_bipc9996 = index_redirect_to_RATABASE_SIT2_bipc9996

transforms.conf:

[index_redirect_to_RATABASE_SIT2_bipc9996]
REGEX = .
DEST_KEY = _MetaData:Index
FORMAT = RATABASE_SIT2

As you can see I'm simply using "." as regex - this is because the source matching was already performed in props.conf, so no further matching should be needed.

View solution in original post

strive
Influencer

I assume the issue is with source. The source that you have set in props.conf might not be right

You need to set sourcetype in your inputs.conf file. Something like

[monitor:///app_qa/vodn_01/logfiles/current/bipc999*]  
followSymlink=true  
crcSalt = <source>  
sourcetype = bipc999

props.conf can contain

[bipc999]  
TRANSFORMS-routing_SIT2_bipc9996 = index_redirect_to_RATABASE_SIT2_bipc9996

It depends on what kind of forwarder you are using. If you use light forwarder then props and transforms should be on indexer.

0 Karma

strive
Influencer

Splunk doesn't recommend overriding source, hence i work with sourcetypes mostly 🙂

http://docs.splunk.com/Documentation/Splunk/6.1.2/admin/Inputsconf

0 Karma

strive
Influencer

are you using heavy forwarder or light forwarder?

0 Karma

Ayn
Legend

Easiest thing would be to set the correct index directly in inputs.conf on the forwarder.

[monitor:///app_qa/vodn_01/logfiles/current/bipc9996.stdout]
index = RATABASE_SIT2
...

Otherwise if you don't want that for some reason, this can be done almost like what you've pasted but NOT on the forwarders - it needs to go on the full Splunk instance that performs parsing of the logs, which is often your indexers.

props.conf:

[source::/app_qa/vodn_01/logfiles/current/bipc9996.stdout]
TRANSFORMS-routing_SIT2_bipc9996 = index_redirect_to_RATABASE_SIT2_bipc9996

transforms.conf:

[index_redirect_to_RATABASE_SIT2_bipc9996]
REGEX = .
DEST_KEY = _MetaData:Index
FORMAT = RATABASE_SIT2

As you can see I'm simply using "." as regex - this is because the source matching was already performed in props.conf, so no further matching should be needed.

mookiie2005
Communicator

The path did not quite work for me, I ended up have to use this:

[source::/app_qa/vodn_01/logfiles/.../bipc9996.stdout]
I found that the current directory was a symbolic link and this was the only way to get it to index the log. If I used the below it would not work correctly:
[source::/app_qa/vodn_01/logfiles/*/bipc9996.stdout]

0 Karma
Get Updates on the Splunk Community!

Stay Connected: Your Guide to May Tech Talks, Office Hours, and Webinars!

Take a look below to explore our upcoming Community Office Hours, Tech Talks, and Webinars this month. This ...

They're back! Join the SplunkTrust and MVP at .conf24

With our highly anticipated annual conference, .conf, comes the fez-wearers you can trust! The SplunkTrust, as ...

Enterprise Security Content Update (ESCU) | New Releases

Last month, the Splunk Threat Research Team had two releases of new security content via the Enterprise ...