Splunk Search

Compare values from multiple Data Inputs

achudnoff
Explorer

I'm trying to write a search that will compare values from different data inputs and return the highest value to use as a rangemap. The values are cpu usage, memory usage, disk read percentage and write percentage. CPU, memory and Disk IO come from different data inputs. When I use the search below, it build the table I want, but the different inputs show up on different rows, so the compare doesn't function properly. My search is:

index="rws_wmi" ComputerName=csiadrws01 |
eval cpu=PercentProcessorTime |
eval mem=PercentCommittedBytesInUse |
eval read=PercentDiskReadTime |
eval write=PercentDiskWriteTime |
eval health=max(cpu, mem, read, write) |
rangemap field=health low=0-50 elevated=51-80 severe=81-100 |
table cpu mem read write health range

Any advice would be great.

Tags (2)
0 Karma
1 Solution

lguinn2
Legend

Try this instead

index="rws_wmi" ComputerName=csiadrws01 |
stats max(PercentProcessorTime) as cpu max(PercentCommittedBytesInUse) as mem
        max(PercentDiskReadTime) as read max(PercentDiskWriteTime) as write |
eval health=max(cpu, mem, read, write) |
rangemap field=health low=0-50 elevated=51-80 severe=81-100 

I don't really understand the health field, but I still think this will work. If it doesn't, try running the command without the eval and rangemap, just to see what you get back. Note that the spacing is just for readability.

View solution in original post

lguinn2
Legend

Try this instead

index="rws_wmi" ComputerName=csiadrws01 |
stats max(PercentProcessorTime) as cpu max(PercentCommittedBytesInUse) as mem
        max(PercentDiskReadTime) as read max(PercentDiskWriteTime) as write |
eval health=max(cpu, mem, read, write) |
rangemap field=health low=0-50 elevated=51-80 severe=81-100 

I don't really understand the health field, but I still think this will work. If it doesn't, try running the command without the eval and rangemap, just to see what you get back. Note that the spacing is just for readability.

achudnoff
Explorer

This looks like exactly what I wanted. Thanks so much!

0 Karma
Get Updates on the Splunk Community!

Continuing Innovation & New Integrations Unlock Full Stack Observability For Your ...

You’ve probably heard the latest about AppDynamics joining the Splunk Observability portfolio, deepening our ...

Monitoring Amazon Elastic Kubernetes Service (EKS)

As we’ve seen, integrating Kubernetes environments with Splunk Observability Cloud is a quick and easy way to ...

Cloud Platform & Enterprise: Classic Dashboard Export Feature Deprecation

As of Splunk Cloud Platform 9.3.2408 and Splunk Enterprise 9.4, classic dashboard export features are now ...