Splunk Dev

Multyple sources display only one value

andrei1bc
Communicator

Hi,

How can I display in a single value chart only the value that is 2 when that occurs, or a single value 1 when other values are not present in a given time frame

Events :

source = A value = 1
source = B value = 1
source = C value = 1
source = D value = 1
..
source = A value = 1
source = B value = 2
source = C value = 1
source = D value = 1

My search :

sourcetype=test | dedup value | stats last(value)

Result :

Will only show me the value = 1 and if value = 2 occurs, I do not see it.

Please assist.

Tags (1)
0 Karma

woodcock
Esteemed Legend

Like this:

 sourcetype=test | dedup value source

Or:

sourcetype=test | stats earliest(value) latest(value) min(value) max(value) avg(value) BY source

Depending on what priority you have regarding each source's value.

0 Karma

jkat54
SplunkTrust
SplunkTrust

'stats last(value)' shows the oldest value
'stats latest(value)' shows the newest value in the index

Both require accurate timestamping and do not take into account data that could be in flight / indexing lag. Meaning the results could vary based on when you run the search and how long it takes data to "get/be" there.

I get the feeling you've greatly simplified what the possible values are and you're really looking for deviations from the common values though.

If that's the case you might be looking for something a bit more complicated like this

rootSearchHere NOT [ rootSearchHere | top 1 value by source | return $source $value] | stats values(value) by source

This would remove the top 1 most common values per source from the search and return the other values by source.

DalJeanis
Legend

That seems like great questionmancy. Upvote for divining the purpose of the question and aiming to solve the underlying issues rather than answer only what was asked.

0 Karma

jkat54
SplunkTrust
SplunkTrust

Cheers Mate!

0 Karma

niketn
Legend

You just need to change from last to max()

<Your Base Search>
| stats max(value) as MaxValue by source
____________________________________________
| makeresults | eval message= "Happy Splunking!!!"
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!

Event Series: Telemetry Pipeline Management

Balancing Scale and Spend: Gaining Control Over High-Volume Metrics in Splunk Observability Cloud As ...

Kick the Tires Before You Commit: A Hands-On Tour of the Splunk Observability Cloud ...

Evaluating an enterprise observability platform usually goes like this: fill out a form, get a free trial with ...

Deep insights, no barriers: Splunk Observability Cloud Free Edition

As software delivery cycles continue to accelerate, observability shouldn’t be a luxury — it should be a ...