Splunk Search

Why am I not getting expected results using inputlookup with a time chart?

nmohammed
Contributor

I have the following search which displays the table on calls based on their time range.

sourcetype=elogs clientid=abc |bucket _time span=5m | chart  count(eval(exec_time_ms <300)) AS "A (<300ms)", count(eval(exec_time_ms >300 AND exec_time_ms <600)) AS "B (>300ms <600ms)", count(eval(exec_time_ms >600 AND exec_time_ms <1000)) AS "C (>600ms <1000ms)", count(eval(exec_time_ms >1000 AND exec_time_ms <3000)) AS "D (>1000ms <3000ms)", count(eval(exec_time_ms >3000)) AS "E (>3000ms)"

The above search works fine, but now we want to monitor a selected list of calls and measure their response times based on the buckets. I have read the inputlookup command and tried using it, but not able to get any results.

Our new search would be :

sourcetype=elogs |inputlookup heavy_calls.csv |bucket _time span=5m | chart  count(eval(exec_time_ms <300)) AS "A (<300ms)", count(eval(exec_time_ms >300 AND exec_time_ms <600)) AS "B (>300ms <600ms)", count(eval(exec_time_ms >600 AND exec_time_ms <1000)) AS "C (>600ms <1000ms)", count(eval(exec_time_ms >1000 AND exec_time_ms <3000)) AS "D (>1000ms <3000ms)", count(eval(exec_time_ms >3000)) AS "E (>3000ms)"

the heavy_calls.csv has the following data (there are about 10 calls in the csv) :

call,heavy
Call.a,1
Call.b,1

What we want to see

calls      A   B   C   D   E
Call.a     1   2   5   1   0
Call.b     5   4   2   1   4

Thanks

Tags (2)
0 Karma
1 Solution

woodcock
Esteemed Legend

Like this:

sourcetype=elogs [|inputlookup heavy_calls.csv | fields call] | chart count(eval(exec_time_ms <300)) AS "A (<300ms)", count(eval(exec_time_ms >300 AND exec_time_ms <600)) AS "B (>300ms <600ms)", count(eval(exec_time_ms >600 AND exec_time_ms <1000)) AS "C (>600ms <1000ms)", count(eval(exec_time_ms >1000 AND exec_time_ms <3000)) AS "D (>1000ms <3000ms)", count(eval(exec_time_ms >3000)) AS "E (>3000ms)" BY call | rename call As calls

View solution in original post

woodcock
Esteemed Legend

Like this:

sourcetype=elogs [|inputlookup heavy_calls.csv | fields call] | chart count(eval(exec_time_ms <300)) AS "A (<300ms)", count(eval(exec_time_ms >300 AND exec_time_ms <600)) AS "B (>300ms <600ms)", count(eval(exec_time_ms >600 AND exec_time_ms <1000)) AS "C (>600ms <1000ms)", count(eval(exec_time_ms >1000 AND exec_time_ms <3000)) AS "D (>1000ms <3000ms)", count(eval(exec_time_ms >3000)) AS "E (>3000ms)" BY call | rename call As calls

nmohammed
Contributor

Awesome..!! thanks Somuch Woodcock. This worked.

0 Karma

diogofgm
SplunkTrust
SplunkTrust

Can you post some sample data? How do you relate the data with the csv?

------------
Hope I was able to help you. If so, some karma would be appreciated.
0 Karma
Get Updates on the Splunk Community!

Detecting Remote Code Executions With the Splunk Threat Research Team

REGISTER NOWRemote code execution (RCE) vulnerabilities pose a significant risk to organizations. If ...

Observability | Use Synthetic Monitoring for Website Metadata Verification

If you are on Splunk Observability Cloud, you may already have Synthetic Monitoringin your observability ...

More Ways To Control Your Costs With Archived Metrics | Register for Tech Talk

Tuesday, May 14, 2024  |  11AM PT / 2PM ET Register to Attend Join us for this Tech Talk and learn how to ...