Getting Data In

Simple field extraction with data index from /var/spool/splunk

tkropp
Path Finder

Not working......

I'm testing field extractions on some new logs. I created simple regex to extract server names from the logs, and used REPORTS in transforms. The field extraction is not working at search time. validated with rex.

| rex field=_raw "(?<servername> [a-z][a-z]-[a-z][a-z][a-z][0-9][0-9])"


-rw------- 1 root   root    75 Apr 12 20:51 props.conf
-rw-r--r-- 1 root   root   111 Apr 12 19:50 transforms.conf
[root@id-spk01 local]# pwd
/opt/splunk/etc/system/local

--------------------------------
#props

[sourcetype::CoreLogs]
REPORT-servername = core_server_name

#transforms

[core_server_name]
REGEX = ([a-z][a-z]-[a-z][a-z][a-z][0-9][0-9])
FORMAT = core_server_name::"$1"
Tags (2)
0 Karma
1 Solution

gkanapathy
Splunk Employee
Splunk Employee

You shouldn't have

[sourcetype::whatever]

but just

[whatever]

Also, omit the quotes from around $1, i.e. fieldname::$1 instead of fieldname::"$1".

View solution in original post

gkanapathy
Splunk Employee
Splunk Employee

You shouldn't have

[sourcetype::whatever]

but just

[whatever]

Also, omit the quotes from around $1, i.e. fieldname::$1 instead of fieldname::"$1".

jrodman
Splunk Employee
Splunk Employee

IN addition, your rex command is trying to capture a space, while your extraction is not trying to capture a space. I'm not sure if you want one or not. If you do, that would probably be REGEX = \s([a-z][a-z]-[a-z][a-z][a-z][0-9][0-9])

0 Karma
Get Updates on the Splunk Community!

Built-in Service Level Objectives Management to Bridge the Gap Between Service & ...

Wednesday, May 29, 2024  |  11AM PST / 2PM ESTRegister now and join us to learn more about how you can ...

Get Your Exclusive Splunk Certified Cybersecurity Defense Engineer at Splunk .conf24 ...

We’re excited to announce a new Splunk certification exam being released at .conf24! If you’re headed to Vegas ...

Share Your Ideas & Meet the Lantern team at .Conf! Plus All of This Month’s New ...

Splunk Lantern is Splunk’s customer success center that provides advice from Splunk experts on valuable data ...