- Mark as New
- Bookmark Message
- Subscribe to Message
- Mute Message
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
How do I extract a value from the 'source' field at search-time?
Mick

Splunk Employee
04-13-2010
06:40 PM
My log directories are structured like so -
/var/myapplogs/<app-name>/logs/*.log
How can I extract <app-name>
as a field name at search time?
- Mark as New
- Bookmark Message
- Subscribe to Message
- Mute Message
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
gkanapathy

Splunk Employee
04-13-2010
08:17 PM
In search:
... | rex field=source "^/[^\/]/[^\/]/(?<app_name>[^\/])"
or in props.conf:
[mysourcetype]
EXTRACT-appname = ^/[^\/]/[^\/]/(?<app_name>[^\/]) in source
- Mark as New
- Bookmark Message
- Subscribe to Message
- Mute Message
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
gkanapathy

Splunk Employee
03-03-2011
10:02 PM
No. Fields extracted from non-raw indexed fields won't search correctly unless you also configure the extracted field as INDEXED_VALUE = false
in the fields.conf file.
- Mark as New
- Bookmark Message
- Subscribe to Message
- Mute Message
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

dwaddle

SplunkTrust
03-03-2011
02:28 PM
If you go with the props.conf approach, does this then make it possible to do searches on 'appname=fooapp' ?
