is it possible to define the source and sourcetype fields to match a folder name? On each server our log structure for our products are as follows
I'd like for the Company_Name folders to be defined as the source, and product folder to be defined as source type.
how do I go about doing this? I've read that this can be done in props for actual files, but I don't see an example for an actual folder location.
I guess you could do it off the
source value, along these lines (have not tried it myself)
[source::f:\Logs\...\*.txt] TRANSFORMS-change_stuff = change_sourcetype, change_source
[change_sourcetype] SOURCE_KEY = MetaData:Source REGEX = F:\\Logs\\[^\\]+\\([^\\]+)\\ DEST_KEY = MetaData:Sourcetype FORMAT = sourcetype::$1 [change_source] SOURCE_KEY = MetaData:Source REGEX = F:\\Logs\\([^\\]+)\\ DEST_KEY = MetaData:Source FORMAT = source::$1
However I think you should think a bit on whether you really want to do that. See this section in the manual;
on the server, yes. Unless it's a heavy forwarder.
No you can't attach files like that, but you could just edit your original post with the relevant portions of the props.conf and transforms.conf files
now I'm updating the props/transform on my splunk server, not on the forwarder correct?
I'd attach the two files, but I don't see a button to do this, and copy/paste surpasses the number of characters allowed in the boxes.
sorry bout the confusion, what I mean is where you put
perhaps you could post your props.conf and transforms.conf (relevant sections only). Anonymize as needed.
Hmm.. either there is something wrong with your props.conf stanza header, i.e. it does not match your logs (and thus do not being passed to the transform), or you are looking at old events (this only affects new data coming in).
Or there is a spelling error somewhere.
And as always, put them in
$SPLUNK_HOME/etc/system/local for now. move to an app later if you want/need.
ok, I think I'm missing something as it appears to be pulling the data in as before. When I open the props/transform file from the system\default folder it states not to update that file, changes should be made in the system\local directory. So I copied both files and put them in the system\local directory and updated them as you suggested. I stopped the server and forwarder, then cleaned out the data and turned them on to pull it in again. Data appears to be coming in as before. By this I mean I would like to go to the search field and just type source="company_name". What am I missing?
It's actually done with both the props.conf and the transforms.conf
basically you have a props.conf kinda like this:
then a transforms.conf like this:
[setCompanySourceType] SOURCE_KEY = MetaData:Source REGEX = F:\\Logs\\(\w+_\w+)\\ FORMAT = sourcetype::$1 DEST_KEY = MetaData:Sourcetype
Now you can switch this around for whatever combination you need but basically you are assigning metaData thru regex.