Splunk Search

How to configure search-time fields

mburbidg
Explorer

I cannot find in the manual how to configure search-time field extraction. I would like to define some fields that apply across all sourcetype. I was told by a splunk trainer that you can't do that using the interactive field extraction tool but can do it in the configuration files.

Anyway I've search through the documentation and can't find either an example of description of how to do this.

0 Karma

southeringtonp
Motivator

Looks like you already figured out the first part, but just in case, here's a good reference:
     http://www.splunk.com/base/Documentation/latest/Knowledge/Createandmaintainsearch-timefieldextractio...

If you want the extraction to apply to all sourcetypes, then just create your entry in props.conf at the top of the file, outside of any stanza heading. Entries in the file that are not beneath a [stanza] header are considered to be global.

There's no way to do a wildcard like [log4j-*], at least as of Splunk 4.1. There are three main options:

  1. Define the extraction globally, putting your EXTRACT-xxx or REPORT-xxx line at the top of props.conf.
  2. Define the extraction multiple times, with a separate stanza for each sourcetype
  3. Define the extraction for sourcetype [log4j], and rename each log4j-xxx sourcetype. Going forward, manually assign the sourcetype so that you don't get the variations.

Option 3 is usually preferable.

0 Karma

mburbidg
Explorer

I discovered that if the sourcetype is log4j-100, which is a single instances of a set of rolling logs then the field shows up in the field picker and works. Can't I wildcard the sourcetype?

0 Karma

mburbidg
Explorer

I found the documentation in the knowledge worker manual. I put the following in etc/system/local/props.conf

[log4j*]
EXTRACT-magazineTitle = (?i) magazineTitle:(?P.+?)\s+\w+:

The extractions shows up in the fields manager, but when I do searches it does not show up in the field picker. Is that normal?

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 ...