Splunk Search

Query email sent success or failed

shanaz
Engager

Please suggest a splunk query to find whether email abc@def.com successfully sent emails or any emails failed between 5-6pm to qbc@xyz.com

Labels (4)
0 Karma
1 Solution

ro_mc
Path Finder

You should adjust the following query based on the index and sourcetype of your email data.

If you don't have extracted fields, you can just list the email addresses on the first line.

sender_field=abc@def.com recipient_field=qbc@xyz.com
earliest="9/20/2021:17:00:00" latest="9/20/2021:18:00:00"
| stats count by sender_field, recipient_field, status

Alternatively, you can schedule an alert to run with a cron schedule of 5 18 * * * with an earliest -65m@m and latest of -5m@m.

The status is the field that advises of success or failure. If this is not present, you can extract it using something like

| rex field=_raw "<text before status>(?<status>[^\s]+)"

This will extract one or more characters after the specified text up until the next space.

View solution in original post

ro_mc
Path Finder

You should adjust the following query based on the index and sourcetype of your email data.

If you don't have extracted fields, you can just list the email addresses on the first line.

sender_field=abc@def.com recipient_field=qbc@xyz.com
earliest="9/20/2021:17:00:00" latest="9/20/2021:18:00:00"
| stats count by sender_field, recipient_field, status

Alternatively, you can schedule an alert to run with a cron schedule of 5 18 * * * with an earliest -65m@m and latest of -5m@m.

The status is the field that advises of success or failure. If this is not present, you can extract it using something like

| rex field=_raw "<text before status>(?<status>[^\s]+)"

This will extract one or more characters after the specified text up until the next space.

richgalloway
SplunkTrust
SplunkTrust

Search splunkd.log for "sendemail" or the specific email address(es).

---
If this reply helps you, Karma would be appreciated.
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!

Can’t Make It to Boston? Stream .conf25 and Learn with Haya Husain

Boston may be buzzing this September with Splunk University and .conf25, but you don’t have to pack a bag to ...

Splunk Lantern’s Guide to The Most Popular .conf25 Sessions

Splunk Lantern is a Splunk customer success center that provides advice from Splunk experts on valuable data ...

Unlock What’s Next: The Splunk Cloud Platform at .conf25

In just a few days, Boston will be buzzing as the Splunk team and thousands of community members come together ...