Splunk Search

Join two queries with different fields

JandrevdM
Path Finder

Hi All,

I have two queries which searches for users that use an app. The apps are not in the same fields which was why I had to split the queries. But now I want to join the queries to get the results

Query 1
index=db_it_network sourcetype=pan* url_domain="www.perplexity.ai"
| table user, url_domain, date_month
| stats count by user url_domain date_month 
| chart count by url_domain date_month 
| sort url_domain 0

Query 2
index=db_it_network sourcetype=pan*  app=claude-base OR app=google-gemini* OR app=openai* OR app=bing-ai-base
| table user, app, date_month
| stats count by user app date_month 
| chart count by app date_month 
| sort app 0

results example that I want

AppAugustJuly
claude-base123120
google-gemini12442
openai
153123
bing-ai-base212232
www.perplexity.com1412



Labels (1)
0 Karma
1 Solution

ITWhisperer
SplunkTrust
SplunkTrust

Try this

index=db_it_network sourcetype=pan* url_domain="www.perplexity.ai"
OR app=claude-base OR app=google-gemini* OR app=openai* OR app=bing-ai-base
| eval app=if(url_domain="www.perplexity.ai", url_domain, app)
| table user, app, date_month
| stats count by user app date_month 
| chart count by app date_month 
| sort app 0

View solution in original post

ITWhisperer
SplunkTrust
SplunkTrust

Try this

index=db_it_network sourcetype=pan* url_domain="www.perplexity.ai"
OR app=claude-base OR app=google-gemini* OR app=openai* OR app=bing-ai-base
| eval app=if(url_domain="www.perplexity.ai", url_domain, app)
| table user, app, date_month
| stats count by user app date_month 
| chart count by app date_month 
| sort app 0
Get Updates on the Splunk Community!

Enterprise Security Content Update (ESCU) | New Releases

In December, the Splunk Threat Research Team had 1 release of new security content via the Enterprise Security ...

Why am I not seeing the finding in Splunk Enterprise Security Analyst Queue?

(This is the first of a series of 2 blogs). Splunk Enterprise Security is a fantastic tool that offers robust ...

Index This | What are the 12 Days of Splunk-mas?

December 2024 Edition Hayyy Splunk Education Enthusiasts and the Eternally Curious!  We’re back with another ...