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!

Join Us for Splunk University and Get Your Bootcamp Game On!

If you know, you know! Splunk University is the vibe this summer so register today for bootcamps galore ...

.conf24 | Learning Tracks for Security, Observability, Platform, and Developers!

.conf24 is taking place at The Venetian in Las Vegas from June 11 - 14. Continue reading to learn about the ...

Announcing Scheduled Export GA for Dashboard Studio

We're excited to announce the general availability of Scheduled Export for Dashboard Studio. Starting in ...