Splunk Search

How to display two timecharts on one chart

jerrysplunk88
Explorer

trying to display two timecharts together, to make it easy to spot the time when no response received for the request sent.

the search looks like this

index="production   "sending request"  | dedup requestId
| timechart span=1h sum(count) as count1

| append [search index="production"  "response received"
| dedup requestId | timechart span=1h sum(count) as count2]

this is not showing the two columns (count1 and count2) I was hoping to see,  appendcol doesn't work either .

 

I tried just using just count

index="production   "sending request"  | dedup requestId
| timechart span=1h count

| append [search index="production"  "response received"
| dedup requestId | timechart span=1h count]

this shows only one column called count.

 

Any help is greatly appreciated!

Labels (3)
0 Karma

kamlesh_vaghela
SplunkTrust
SplunkTrust

@jerrysplunk88 

Can you please try this?

index="production" ("sending request" OR "response received")
| dedup requestId
| timechart sum(eval(if(match(_raw,"sending request"),1,0))) as count1, sum(eval(if(match(_raw,"response received"),1,0))) as count2

 

My Sample Search :

| makeresults | eval raw="aaaaaa sending request bbbbb|cccccc response received dddd|aaaaaa sending request bbbbb", raw=split(raw,"|")| mvexpand raw | rename raw as _raw
|eval requestId=1 | accum requestId
| rename comment as "Upto Now is sample data only" 
| dedup requestId
| timechart sum(eval(if(match(_raw,"sending request"),1,0))) as count1, sum(eval(if(match(_raw,"response received"),1,0))) as count2


 Thanks
KV
▄︻̷̿┻̿═━一

If any of my reply helps you to solve the problem Or gain knowledge, an upvote would be appreciated.

0 Karma

jerrysplunk88
Explorer

Thanks for the solution, I know it could work but in my case, the request and response have the same request ID so putting them in one search and dedup will get the wrong count.

Is there any way to use two searches and combine the results?

0 Karma

kamlesh_vaghela
SplunkTrust
SplunkTrust

@jerrysplunk88 

Can you please try this?

YOUR_SEARCH
| eval sr1=if(match(_raw,"sending request"),requestId,null()), sr2=if(match(_raw,"response received"),requestId,null())
| timechart dc(sr1) as count1, dc(sr2) as count2

 

My Sample Search :

| makeresults | eval raw="aaaaaa sending request bbbbb&&cccccc response received dddd|aaaaaa sending request bbbbb", raw=split(raw,"|") | mvexpand raw 
|eval requestId=1 | accum requestId | eval raw=split(raw,"&&") | mvexpand raw  | rename raw as _raw
| rename comment as "Upto Now is sample data only" 
| eval sr1=if(match(_raw,"sending request"),requestId,null()), sr2=if(match(_raw,"response received"),requestId,null())
| timechart dc(sr1) as count1, dc(sr2) as count2

Thanks
KV
▄︻̷̿┻̿═━一

If any of my reply helps you to solve the problem Or gain knowledge, an upvote would be appreciated.

Get Updates on the Splunk Community!

Stay Connected: Your Guide to May Tech Talks, Office Hours, and Webinars!

Take a look below to explore our upcoming Community Office Hours, Tech Talks, and Webinars this month. This ...

They're back! Join the SplunkTrust and MVP at .conf24

With our highly anticipated annual conference, .conf, comes the fez-wearers you can trust! The SplunkTrust, as ...

Enterprise Security Content Update (ESCU) | New Releases

Last month, the Splunk Threat Research Team had two releases of new security content via the Enterprise ...