I'm looking for tips & tricks for tracking down props-related configuration issues. These kind of things can be a pain to track down and generally use up a bunch of time getting to the root cause, so I would like to consolidate some common troubleshooting techniques to refer people to.
Often times these kind of problems are hard to describe beyond "splunk appears to be ignoring my settings"; and most often the truth is that it's not a splunk problem but a configuration problem...
If there are lots of ideas, perhaps the most useful stuff can be put on a community wiki page
Most common mistakes:
splunkd
?TRANSFORM
instead of TRANSFORMS
) These can be difficult to spot.props.conf
settings in one app and then setup an inputs.conf
in a different app. Unless your props entries are exported, you probably will not get the results you are looking for.)prop.conf
(instead of props.conf
), splunk will ignore them. Nearly all of the config files are plural.)I had the same issue, and my custom apps directory didnt have the metadata folder, that is why my custom props.conf wasn't working.
The metadata folder should have one file called local.meta and the contents of the file are
[]
access = read : [ * ], write : [ admin ]
export = system
Hope it helps!
Happy Splunking!
Some people have found this useful: http://www.splunk.com/wiki/Where_do_I_configure_my_Splunk_settings%3F
Wow. That is a great page, I don' think I had seen that page before. Thank's for pointing it out. (For the sake of a consolidated answer, I've added this link under "Additional resources" on the answer above). Thanks!
Lowell, this is fantastic, I had been working some issues around props.conf but it would have taken me months to resolve indexing a few records at a time. With these steps I had great success and have ironed out the majority of my issues.
Brian
Glad to hear it.
Update for Splunk 5/6:
I should probably rewrite this answer completely. Splunk has made some great changes that simplify troubleshooting this kind of problem since the early 4.x releases (which is when this answer was first written.) I don't have time for a full rewrite, but here are some highlights that I would expand upon if/when I get around do to a more thorough re-write...
Splunk provides a few utilities that can greatly speed up the process of tracking down props-related config problems. The first two can even be used to check configuration changes without restarting splunkd. (Although, you need to restart splunkd once you get your configuration issues resolved.)
This utility will show you all of the relevant props config entries for a given log file. This let's you quickly test your source to sourcetype matching rules are working properly. (Or, it test that any rules:: or delayedrule:: are functioning properly.) It will also reveal simple issues of file permission. I've often found this useful in detecting overlapping source rules or issues with stanza priorities.
Example:
splunk test sourcetype /var/log/your_log_file
Update: The output format of this command is all on one line and difficult to read, IMHO. So I normally use this sed command to make it more readable:
splunk test sourcetype /var/log/your_log_file | sed -re "s/-> '([^']*)'/ = \1\n/g;s/\{/\{\n /;s/}/}\n/"
This utility can be used to dump a nested configuration for a specific config file or a specific stanza within a config file. You can optionally specify which application you would like to test this from. (Normally you will want to specify whichever application your have your inputs.conf setup to use.)
$SPLUNK_HOME/bin/splunk cmd btool props list <sourcetype>
The file search command in splunk lets you view a local log file as though it were indexed. Not all props settings are honored during this process, but you can often use this to test your setup before adding a new input and catch minor (and sometimes major) problems with timestamp recognition, and event breaking logic before loading anything into your index.
Keep in mind that any settings changes do require a splunkd restart in order to take effect here. (While it's a pain to do so, it's still faster than indexing events improperly and then having to dump your indexes and reload, or try to find and delete incorrectly indexed events.)
Example: (Type this into the search bar)
| file /var/log/your_log_file
If you want to due additional searching on your log file, you can do so with a post-search command, like so:
| file /var/log/your_log_file | search my-search-term NOT unwanted-search-term ...
This trick is useful once you have your events indexed correctly and would like to setup field extractions. This is helpful if you edit your props.conf or transforms.conf files by hand. You should be able to stick it in your search and have your config changes be reloaded which is much faster and less problematic that restarting splunk. (Oh, and don't forget to remove this command before you save your search--you only want to use this interactively on an as-needed basis)
Hi,
great article.
Just found out that
splunk btool check
will do the same checks as a
splunk start
Example: (Typo SOULD_LINEMERGE instead of SHOULD_LINEMERGE)
Invalid key in stanza [myst:test] in
/opt/splk/splunk-624/etc/apps/aa_test/local/props.conf, line 2:
SOULD_LINEMERGE (value: true)
HTH,
Holger
The validate-regex
command sounds just the ticket, but in 6.0.4 it doesn't appear to exist. The only reference to the tool that I can find is your post. Presumably it is new in 6.1 then?
/opt/SPLUNK/6.0/splunk/bin $ ./splunk help test
The 'test' and 'train' commands have been deprecated.
:-(
Probably worth noting the --debug
and --app
options on btool
. --app
in particular will probably help catch many problems.
-debug and -app
Chris, Your right, the "extract reload=T" is a very helpful thing to know about. (I guess I was originally just thinking about indexing issues, but I agree that it makes sense to mention it here.) I've added a note about it.
You might want to add that "| extract reload=T" will make changes in props.conf active. It is explained in the beginning of props.conf.spec file so people who edit props.conf will probably know. But sometimes I forget
Glad your found it useful. (Feel free to vote it up!)
This just made my day... thanks Lowell!!!
Brian