Alerting

Insert Date Into Subject of Email Alert

karinerivet
Engager

When creating an alert, is it possible to insert a date in the email subject line, such as the previous days date?

Tags (4)

imrago
Contributor

Hi,

I succeeded to add a date to the subject by modifying the sendmail.py file, an example:

yesterday = datetime.datetime.now() - datetime.timedelta(days = 1)
message['Subject'] = subject + " " + yesterday.strftime("%d.%m.%Y")

imrago
Contributor

It is located in the /opt/splunk/etc/app/search/bin/ directory.

It is a python script and it can be modified with any text editor. Keep in mind that it will be probably overwritten on the next Splunk update.

0 Karma

karinerivet
Engager

Where is the sendmail.py file, and how do I modify it?

0 Karma
Get Updates on the Splunk Community!

Threat Hunting Unlocked: How to Uplevel Your Threat Hunting With the PEAK Framework ...

WATCH NOWAs AI starts tackling low level alerts, it's more critical than ever to uplevel your threat hunting ...

Splunk APM: New Product Features + Community Office Hours Recap!

Howdy Splunk Community! Over the past few months, we’ve had a lot going on in the world of Splunk Application ...

Index This | Forward, I’m heavy; backward, I’m not. What am I?

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