<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: How to create custom time-alert-email subject? in Alerting</title>
    <link>https://community.splunk.com/t5/Alerting/How-to-create-custom-time-alert-email-subject/m-p/609291#M14142</link>
    <description>&lt;P&gt;If you are using the $result.fieldname$ token that field must be in the result.&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 12 Aug 2022 09:29:15 GMT</pubDate>
    <dc:creator>diogofgm</dc:creator>
    <dc:date>2022-08-12T09:29:15Z</dc:date>
    <item>
      <title>How to create custom time-alert-email subject?</title>
      <link>https://community.splunk.com/t5/Alerting/How-to-create-custom-time-alert-email-subject/m-p/609106#M14133</link>
      <description>&lt;P&gt;I have an alert where i want the below date and time should get displayed in email subject&lt;/P&gt;
&lt;P&gt;Here alert is getting the data from March 02,2022 8:00pm to March 03,2022 8:00pm&lt;/P&gt;
&lt;P&gt;Like from&amp;nbsp; yesterday 8:00pm to today's 8:00pm data and alert will get triggered everyday at 11pm&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I want to get the date and&amp;nbsp; time like shown below&lt;/P&gt;
&lt;P&gt;March 02,2022 8:00pm to March 03,2022 8:00pm&lt;/P&gt;
&lt;P&gt;Thanks in advance&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 11 Aug 2022 04:10:46 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Alerting/How-to-create-custom-time-alert-email-subject/m-p/609106#M14133</guid>
      <dc:creator>Vani_26</dc:creator>
      <dc:date>2022-08-11T04:10:46Z</dc:date>
    </item>
    <item>
      <title>Re: How to create custom time-alert-email subject?</title>
      <link>https://community.splunk.com/t5/Alerting/How-to-create-custom-time-alert-email-subject/m-p/609147#M14134</link>
      <description>&lt;P&gt;You can use tokens on multiple alert actions fields to accomplish that.&lt;/P&gt;&lt;P&gt;Check this docs page:&lt;/P&gt;&lt;P&gt;&lt;A href="https://docs.splunk.com/Documentation/Splunk/9.0.0/Alert/EmailNotificationTokens" target="_blank"&gt;https://docs.splunk.com/Documentation/Splunk/9.0.0/Alert/EmailNotificationTokens&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 11 Aug 2022 11:08:28 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Alerting/How-to-create-custom-time-alert-email-subject/m-p/609147#M14134</guid>
      <dc:creator>diogofgm</dc:creator>
      <dc:date>2022-08-11T11:08:28Z</dc:date>
    </item>
    <item>
      <title>Re: How to create custom time-alert-email subject?</title>
      <link>https://community.splunk.com/t5/Alerting/How-to-create-custom-time-alert-email-subject/m-p/609165#M14135</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/248147"&gt;@Vani_26&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;Is the time displayed in each email alert going to be the same?&lt;/P&gt;&lt;P&gt;Thank you&lt;/P&gt;</description>
      <pubDate>Thu, 11 Aug 2022 12:36:26 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Alerting/How-to-create-custom-time-alert-email-subject/m-p/609165#M14135</guid>
      <dc:creator>Taruchit</dc:creator>
      <dc:date>2022-08-11T12:36:26Z</dc:date>
    </item>
    <item>
      <title>Re: How to create custom time-alert-email subject?</title>
      <link>https://community.splunk.com/t5/Alerting/How-to-create-custom-time-alert-email-subject/m-p/609181#M14136</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/248147"&gt;@Vani_26&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;Considering the following two assumptions: -&lt;/P&gt;&lt;P&gt;1. Your subject line will have date of a prior day and current day.&lt;/P&gt;&lt;P&gt;2. Your subject line will have fixed time: 8 pm.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You can try using the below: -&lt;/P&gt;&lt;P&gt;In SPL of your alert, towards the end, add the below code: -&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;|eval currentDay=strftime(now(),"%B %d, %Y")
|eval lastDay=strftime(relative_time(now(),"-d"),"%B %d, %Y")&lt;/LI-CODE&gt;&lt;P&gt;Then in Splunk alert settings, add the following to your subject line: -&lt;/P&gt;&lt;P&gt;'$result.lastDay$' 8:00 pm to '$result.currentDay$' 8:00 pm&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Please try at your end and share your results.&lt;/P&gt;&lt;P&gt;Thank you&lt;/P&gt;</description>
      <pubDate>Thu, 11 Aug 2022 13:39:05 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Alerting/How-to-create-custom-time-alert-email-subject/m-p/609181#M14136</guid>
      <dc:creator>Taruchit</dc:creator>
      <dc:date>2022-08-11T13:39:05Z</dc:date>
    </item>
    <item>
      <title>Re: How to create custom time-alert-email subject?</title>
      <link>https://community.splunk.com/t5/Alerting/How-to-create-custom-time-alert-email-subject/m-p/609213#M14138</link>
      <description>&lt;P&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/223102"&gt;@Taruchit&lt;/a&gt;&amp;nbsp;, yes it is coming as expected, but i dont want to see this lastDay and currentDay fields in the query&amp;nbsp; table.&lt;BR /&gt;&lt;BR /&gt;so i tried doing&amp;nbsp; |fields -&amp;nbsp; lastDay&amp;nbsp;currentDay&lt;BR /&gt;&lt;BR /&gt;but when i am adding this in the query , it is not showing up, but in the email subject it is not showing up March08,2022. this is missing.&lt;/P&gt;&lt;P&gt;How can do this?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 11 Aug 2022 19:42:58 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Alerting/How-to-create-custom-time-alert-email-subject/m-p/609213#M14138</guid>
      <dc:creator>Vani_26</dc:creator>
      <dc:date>2022-08-11T19:42:58Z</dc:date>
    </item>
    <item>
      <title>Re: How to create custom time-alert-email subject?</title>
      <link>https://community.splunk.com/t5/Alerting/How-to-create-custom-time-alert-email-subject/m-p/609273#M14139</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/248147"&gt;@Vani_26&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;Let us assume your Splunk alert has results with five fields with field names: - A, B, C,&amp;nbsp; D, E.&lt;/P&gt;&lt;P&gt;You can add the below code in your SPL: -&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;|fields A, B, C, D, E&lt;/LI-CODE&gt;&lt;P&gt;This will allow you to display the relevant fields only in your Splunk results and also use the two extra fields we added for adding the dates in Splunk alert.&lt;/P&gt;&lt;P&gt;Please share if the above helps to resolve the issue.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you&lt;/P&gt;</description>
      <pubDate>Fri, 12 Aug 2022 08:23:02 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Alerting/How-to-create-custom-time-alert-email-subject/m-p/609273#M14139</guid>
      <dc:creator>Taruchit</dc:creator>
      <dc:date>2022-08-12T08:23:02Z</dc:date>
    </item>
    <item>
      <title>Re: How to create custom time-alert-email subject?</title>
      <link>https://community.splunk.com/t5/Alerting/How-to-create-custom-time-alert-email-subject/m-p/609274#M14140</link>
      <description>&lt;P&gt;Thus, in your existing SPL of the alert, you can the following: -&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;|eval currentDay=strftime(now(),"%B %d, %Y")
|eval lastDay=strftime(relative_time(now(),"-d"),"%B %d, %Y")
|fields &amp;lt;list of field names which you need in the alert&amp;gt;&lt;/LI-CODE&gt;&lt;P&gt;Please share if the above helps to accomplish your solution.&lt;/P&gt;&lt;P&gt;Thank you&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 12 Aug 2022 08:25:57 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Alerting/How-to-create-custom-time-alert-email-subject/m-p/609274#M14140</guid>
      <dc:creator>Taruchit</dc:creator>
      <dc:date>2022-08-12T08:25:57Z</dc:date>
    </item>
    <item>
      <title>Re: How to create custom time-alert-email subject?</title>
      <link>https://community.splunk.com/t5/Alerting/How-to-create-custom-time-alert-email-subject/m-p/609291#M14142</link>
      <description>&lt;P&gt;If you are using the $result.fieldname$ token that field must be in the result.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 12 Aug 2022 09:29:15 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Alerting/How-to-create-custom-time-alert-email-subject/m-p/609291#M14142</guid>
      <dc:creator>diogofgm</dc:creator>
      <dc:date>2022-08-12T09:29:15Z</dc:date>
    </item>
    <item>
      <title>Re: How to create custom time-alert-email subject?</title>
      <link>https://community.splunk.com/t5/Alerting/How-to-create-custom-time-alert-email-subject/m-p/609299#M14143</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/90723"&gt;@diogofgm&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;I tried by using the below: -&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;|fields &amp;lt;list of required field names&amp;gt;&lt;/LI-CODE&gt;&lt;P&gt;And in the above code I left out the fieldname that is used in Splunk alert.&amp;nbsp;&lt;/P&gt;&lt;P&gt;But it still worked for me when I invoked that fieldname in subject line of the Splunk email alert.&lt;/P&gt;&lt;P&gt;Thank you&lt;/P&gt;</description>
      <pubDate>Fri, 12 Aug 2022 09:54:06 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Alerting/How-to-create-custom-time-alert-email-subject/m-p/609299#M14143</guid>
      <dc:creator>Taruchit</dc:creator>
      <dc:date>2022-08-12T09:54:06Z</dc:date>
    </item>
    <item>
      <title>Re: How to create custom time-alert-email subject?</title>
      <link>https://community.splunk.com/t5/Alerting/How-to-create-custom-time-alert-email-subject/m-p/609382#M14153</link>
      <description>&lt;P&gt;My requirement is also same but if I don't add the field names in the query&amp;nbsp;&lt;/P&gt;&lt;P&gt;The date and month is not getting displayed.&lt;/P&gt;</description>
      <pubDate>Sat, 13 Aug 2022 02:09:21 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Alerting/How-to-create-custom-time-alert-email-subject/m-p/609382#M14153</guid>
      <dc:creator>Vani_26</dc:creator>
      <dc:date>2022-08-13T02:09:21Z</dc:date>
    </item>
    <item>
      <title>Re: How to create custom time-alert-email subject?</title>
      <link>https://community.splunk.com/t5/Alerting/How-to-create-custom-time-alert-email-subject/m-p/609383#M14154</link>
      <description>&lt;P&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/223102"&gt;@Taruchit&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I tried doing by adding&amp;nbsp;&lt;/P&gt;&lt;P&gt;I fields a b c d&amp;nbsp;&lt;/P&gt;&lt;P&gt;But if I don't add the date fields it is not showing up in the email subject&lt;/P&gt;&lt;P&gt;Please suggest&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 13 Aug 2022 02:13:02 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Alerting/How-to-create-custom-time-alert-email-subject/m-p/609383#M14154</guid>
      <dc:creator>Vani_26</dc:creator>
      <dc:date>2022-08-13T02:13:02Z</dc:date>
    </item>
  </channel>
</rss>

