Getting Data In

Can I change the name of attachments which are sent via schedule saved searches?

rgonzale6
Path Finder

What I'd like is to have the date appended to the file name. Currently we have a scheduled saved search running each night that emails results out. The file names are identical every night as currently configured. I don't think there is a GUI fix, but I've looked at alert_actions.conf and don't see where I could make this change.

Thanks

Tags (3)
0 Karma
1 Solution

Simeon
Splunk Employee
Splunk Employee

I believe there is an enhancement request to do this. Currently, you could edit the python script that performs the email alert. Before considering this action, you should be aware of the following:

  1. editing this is NOT supported
  2. upgrading may overwrite your change
  3. See #1

With that said, you can find the file here: $SPLUNK_HOME/etc/apps/search/bin/sendemail.py

The line you would want to edit is:

filename = "splunk-results.csv"

View solution in original post

rgonzale6
Path Finder

In case anyone needs to do something similar...here are the changes I made to sendemail.py:

added:
import datetime
import time
today= datetime.date.today()

modified:

    filename = 'splunk-results'
    filename += str(today)
    filename += ".csv"

results:

splunk-results2010-05-11.csv

Simeon
Splunk Employee
Splunk Employee

I believe there is an enhancement request to do this. Currently, you could edit the python script that performs the email alert. Before considering this action, you should be aware of the following:

  1. editing this is NOT supported
  2. upgrading may overwrite your change
  3. See #1

With that said, you can find the file here: $SPLUNK_HOME/etc/apps/search/bin/sendemail.py

The line you would want to edit is:

filename = "splunk-results.csv"

rgonzale6
Path Finder

Thanks! This was quite helpful.

0 Karma
Get Updates on the Splunk Community!

Index This | I am a number, but when you add ‘G’ to me, I go away. What number am I?

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

What’s New in Splunk App for PCI Compliance 5.3.1?

The Splunk App for PCI Compliance allows customers to extend the power of their existing Splunk solution with ...

Extending Observability Content to Splunk Cloud

Register to join us !   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to ...