Splunk Search

multiple searches combine into one report

ajromero
Path Finder

I have 3 reports that I want to put into one report, here is my search

sourcetype=MSExchange:*:MessageTracking source_id=SMTP (event_id=RECEIVE) user_bunit=Energy recipient_domain="IID.com"
| stats count as RECEIVE by recipient
|append
[search sourcetype=MSExchange:*:MessageTracking source_id=SMTP (event_id=SEND) user_bunit=Energy recipient_domain="IID.com" | stats count as SEND by recipient]
|table recipient, SEND, RECEIVE

The data I get is only the recipient and RECEIVE data, it does not display the SEND information

what  I missing here

 

 

Labels (1)
0 Karma
1 Solution

richgalloway
SplunkTrust
SplunkTrust

It seems like the answer should be clear, but I'm drawing a blank ATM.  Try this variant, instead.  BTW, you said 3 searches, but the query only does 2.

sourcetype=MSExchange:*:MessageTracking source_id=SMTP (event_id=RECEIVE OR event_id=SEND) user_bunit=Energy recipient_domain="IID.com"
| stats sum(eval(event_id=RECEIVE)) as RECEIVE, sum(eval(event_id=SEND)) by recipient
|table recipient, SEND, RECEIVE

This should run faster since it only makes one pass through the index (which you should specify). 

---
If this reply helps you, Karma would be appreciated.

View solution in original post

richgalloway
SplunkTrust
SplunkTrust

It seems like the answer should be clear, but I'm drawing a blank ATM.  Try this variant, instead.  BTW, you said 3 searches, but the query only does 2.

sourcetype=MSExchange:*:MessageTracking source_id=SMTP (event_id=RECEIVE OR event_id=SEND) user_bunit=Energy recipient_domain="IID.com"
| stats sum(eval(event_id=RECEIVE)) as RECEIVE, sum(eval(event_id=SEND)) by recipient
|table recipient, SEND, RECEIVE

This should run faster since it only makes one pass through the index (which you should specify). 

---
If this reply helps you, Karma would be appreciated.

alonsocaio
Contributor

Hi,

Could you please provide a sample of your logs?


Based on the fields described in your search I created a sample file and could reach the results using the following query:

index=... source_id=SMTP (event_id=RECEIVE) user_bunit=Energy recipient_domain="IID.com" 
| stats count as RECEIVE by recipient 
| append
    [ search index=... source_id=SMTP (event_id=SEND) user_bunit=Energy recipient_domain="IID.com" 
    | stats count as SEND by recipient] 
| stats values(SEND) as SEND, values(RECEIVE) as RECEIVE by recipient

The was my output:

alonsocaio_0-1592871009955.png

 

0 Karma
Get Updates on the Splunk Community!

Splunk + ThousandEyes: Correlate frontend, app, and network data to troubleshoot ...

 Are you tired of troubleshooting delays caused by siloed frontend, application, and network data? We've got a ...

Splunk Observability for AI

Don’t miss out on an exciting Tech Talk on Splunk Observability for AI!Discover how Splunk’s agentic AI ...

🔐 Trust at Every Hop: How mTLS in Splunk Enterprise 10.0 Makes Security Simpler

From Idea to Implementation: Why Splunk Built mTLS into Splunk Enterprise 10.0  mTLS wasn’t just a checkbox ...