Splunk Search

How to combine three queries and visualize it in timechart

amitrinx
Explorer

I have three queries:

Overall Traffic to LogOn page

sourcetype="od" operation=LogOn http_method=GET http_url="*LogOn*" |  timechart count span=1m

OAuth1 Traffic to LogOn page

sourcetype="od" operation=LogOn http_method=GET http_url="*LogOn*" http_url!="*authorization.ping*" identity_consumer_key!="" |  timechart count span=1m

OAuth2 Traffic to LogOn page

This is what i wrote
sourcetype="oxygen-standard" identity_operation=LogOn http_method=GET
| eval url= case(http_url=="*LogOn*","Overall",
http_url=="*LogOn*" http_url!="*authorization.ping*" identity_consumer_key!="","OAuth1",
http_url=="*authorization.ping*","OAuth2")
| stats count by url

It is not allowing multiple checks in one case

sourcetype="od" operation=LogOn http_method=GET http_url="*authorization.ping*"  | timechart count span=1m

How can i combine these three to show in one timechart?

Labels (4)
0 Karma

PickleRick
SplunkTrust
SplunkTrust

OK. Try to describe what you want to achieve (in terms of what events you have and what result you want to get from them), not what you're trying to do.

0 Karma

gcusello
SplunkTrust
SplunkTrust

Hi @amitrinx ,

I'm not sure that's possible, aniway, you could try to use append, something like this:

sourcetype="od" operation=LogOn http_method=GET http_url="*LogOn*" http_url!="*authorization.ping*" identity_consumer_key!="" 
|  timechart count span=1m
| append [ search 
   sourcetype="oxygen-standard" identity_operation=LogOn http_method=GET
   | eval url= case(http_url=="*LogOn*","Overall",
http_url=="*LogOn*" http_url!="*authorization.ping*" identity_consumer_key!="","OAuth1",
http_url=="*authorization.ping*","OAuth2")
   | timechart span=1m count by url
   ]
| append [ search 
   sourcetype="od" operation=LogOn http_method=GET http_url="*authorization.ping*"  
   | timechart count span=1m
   ]

remember to setup the same span in all searches.

Ciao.

Giuseppe

0 Karma

yeahnah
Motivator

Hi @amitrinx 

I've tried to decipher your 3 queries and make a query to meet what you are looking to achieve.  Without seeing any sample event data it's not always that easy so I've made some assumptions about the event data and detecting OAuth 1 or 2, which you may need to tweak.  

sourcetype="oxygen-standard" OR sourcetype=od identity_operation=LogOn http_method=GET http_url=*
| eval url=if(isnull(identity_consumer_key) AND match(authorization.ping, "OAuth2"), if(isnull(identity_consumer_key) OR identity_consumer_key!="", "OAuth1", "unknown"), "noauthping")
| timechart span=1m
count AS overall
count(eval(url=="OAuth1")) AS OAuth1
count(eval(url=="OAuth2")) AS OAuth2
count(eval(url=="unknown")) AS unknown
count(eval(url=="noauthping")) AS noauthping

OR, this should provide the same result set

sourcetype="oxygen-standard" OR sourcetype=od identity_operation=LogOn http_method=GET http_url=* ]
| eval url=if(isnull(identity_consumer_key) AND match(authorization.ping, "OAuth2"), if(isnull(identity_consumer_key) OR identity_consumer_key!="", "OAuth1", "unknown"), "noauthping")
| timechart span=1m
count
BY url
| addtotals fieldname="overall"

 

Hope this helps

 

Tags (1)
0 Karma
Career Survey
First 500 qualified respondents will receive a $20 gift card! Tell us about your professional Splunk journey.

Can’t make it to .conf25? Join us online!

Get Updates on the Splunk Community!

Take Action Automatically on Splunk Alerts with Red Hat Ansible Automation Platform

 Are you ready to revolutionize your IT operations? As digital transformation accelerates, the demand for ...

Calling All Security Pros: Ready to Race Through Boston?

Hey Splunkers, .conf25 is heading to Boston and we’re kicking things off with something bold, competitive, and ...

Beyond Detection: How Splunk and Cisco Integrated Security Platforms Transform ...

Financial services organizations face an impossible equation: maintain 99.9% uptime for mission-critical ...