Dashboards & Visualizations

extract fields and plot graphs based on the field values

muraliv
New Member

scenario:

have pushed snmp poll data as an event to splunk as a TCP source.
event format = "parameterId=paramterValue"
event source = SNMPTCP

to-do: need to find minute average of "parameterValue" for a particular "parameterId"

sample event data:

Timestamp event data

5:44:13.000 PM 908=51

5:43:58.000 PM 908=14

5:43:47.000 PM 908=18

5:43:36.000 PM 908=49

5:43:25.000 PM 908=88

5:43:14.000 PM 908=80

5:42:58.000 PM 908=98

5:42:47.000 PM 908=55

5:42:36.000 PM 908=43

5:42:20.000 PM 908=13

when given as a minute wise report

search query - "sourcetype="SNMPTCP" | timechart span 1m count"

5.42 - 4

5.43 - 5

5.44 - 1

but to calculate the parameterValue as follows,

5.42 - ( 13 + 43 + 55 + 98 ) / 4 = 52

5.43 - ( 14 + 18 + 49 + 88 + 80 ) / 5 = 49.8

5.44 - 51 / 1 = 51

what is the query to be executed. i tried extract command but in vain. A sample command will be really helpful.

thanks in advance.

Tags (1)
0 Karma

gfuente
Motivator

Hello

First you´ll need to extract the values with, rex command, something like:

... | rex field=_raw "  908=(?<myvalue>\d+)" | ...

Then you should have a new field to use called "myvalue" and then you only need to make a search like:

sourcetype="SNMPTCP" | timechart span 1m avg(myvalue)

So combining both:

sourcetype="SNMPTCP" | rex field=_raw="  908=(?<myvalue>\d+)"| timechart span 1m avg(myvalue)

Regards

muraliv
New Member

gfuente,
is it possible to achieve the same result by using kv/extract command instead of rex?
if possible please share.

0 Karma

muraliv
New Member

thanks for the prompt reply gfuente.

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!

A Four-Part Event Series: Full Stack Observability For the AI Era

As AI reshapes applications, infrastructure, and the way teams operate, the traditional boundaries of ...

SOC4Kafka - New Kafka Connector Powered by OpenTelemetry

The new SOC4Kafka connector, built on OpenTelemetry, enables the collection of Kafka messages and forwards ...

Event Series: Level up your SOC: Advancing with Splunk Enterprise Security

AI has fundamentally raised the stakes for security operations, and this three-part series is your guide to ...