Dashboards & Visualizations

extract usage basics

muraliv
New Member

Hi,

I understand what extract or kv command does. but what i don't understand is how the extracted values should be used in a timechart command.

for example.

event 1: 10=200,11=210,12=220

event 2: 10=300,11=310,12=320

event 3: 10=400,11=410,12=420

if i want to plot a line graph, which will plot all the values of 10,11 and 12 i'll use as following

source "someosource" | extract kvdelim="=" pairdelim="," auto=f

how should i use the subsequent timechart command. how will i refer the fields 10,11 and 12 in the timecharts.
please guide me since i can't find a complete one to one tutorial with samples for extract command.

thanks in advance.

Tags (3)
0 Karma
1 Solution

martin_mueller
SplunkTrust
SplunkTrust

If I modify your data like this:

event 1: a10=200,a11=210,a12=220
event 2: a10=300,a11=310,a12=320
event 3: a10=400,a11=410,a12=420

Then extract will pull out all the fields without any parameters given. I assume extract refuses to extract numbers as field names. You can still write a rex for that like this:

...  | rex "10=(?<10>\d+)"

View solution in original post

0 Karma

martin_mueller
SplunkTrust
SplunkTrust

If I modify your data like this:

event 1: a10=200,a11=210,a12=220
event 2: a10=300,a11=310,a12=320
event 3: a10=400,a11=410,a12=420

Then extract will pull out all the fields without any parameters given. I assume extract refuses to extract numbers as field names. You can still write a rex for that like this:

...  | rex "10=(?<10>\d+)"
0 Karma

martin_mueller
SplunkTrust
SplunkTrust

With those events extract without any parameters will extract fields called a10, a11, and a12. You can then refer to those field names in successive commands.

For a simple confirmation, append a | table a10 a11 a12 to your extract.

0 Karma

muraliv
New Member

martin,
thanks for your reply. I'm worried about how to use the extracted data in the successive commands

for example
if i use a rex, i'll use a FIELDVALUE variable which'll be used in the successive command

so now, the events look like this
event 1: a10=200,a11=210,a12=220
...

again, my search commands looks like this
source "somesource" | extract kvdelim="=" pairdelim="," auto=f

do i have to use a rex eventhough i use a extract command? how will i refer the extracted fields in the succesive commands. sorry for my ignorance.

please guide me.

regards,
murali v

0 Karma
Got questions? Get answers!

Join the Splunk Community Slack to learn, troubleshoot, and make connections with fellow Splunk practitioners in real time!

Meet up IRL or virtually!

Join Splunk User Groups to connect and learn in-person by region or remotely by topic or industry.

Get Updates on the Splunk Community!

Announcing Modern Navigation: A New Era of Splunk User Experience

We are excited to introduce the Modern Navigation feature in the Splunk Platform, available to both cloud and ...

Modernize your Splunk Apps – Introducing Python 3.13 in Splunk

We are excited to announce that the upcoming releases of Splunk Enterprise 10.2.x and Splunk Cloud Platform ...

Step into “Hunt the Insider: An Splunk ES Premier Mystery” to catch a cybercriminal ...

After a whole week of being on call, you fell asleep on your keyboard, and you hit a sequence of buttons that ...