<?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 Adding a date to a string Message in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Adding-a-date-to-a-string-Message/m-p/416287#M119826</link>
    <description>&lt;P&gt;I am trying to create an error message based on a time frame, the last 15 min. and now. So the error message would say, &lt;/P&gt;

&lt;P&gt;"Client Missed file between 15:15:00 - 15:30:00"&lt;/P&gt;

&lt;P&gt;The times are calculated at the time of the search and the following search below fails as "Error in 'eval' command: Typechecking failed. '+' only takes two strings or two numbers."&lt;/P&gt;

&lt;P&gt;| eval 15MinEarly=strftime(relative_time(now(), "-15m"), "%m/%d/%Y %H:%M:%S") &lt;BR /&gt;
| eval Now=strftime(now(), "%m/%d/%Y %H:%M:%S")&lt;BR /&gt;
| eval ErrorMessage = "Client Missed file between: " + 15MinEarly + " - " Now&lt;/P&gt;

&lt;P&gt;How do you convert the two times to string so I can concatenate them into the error message?&lt;/P&gt;</description>
    <pubDate>Mon, 20 Aug 2018 20:15:36 GMT</pubDate>
    <dc:creator>griffinpair</dc:creator>
    <dc:date>2018-08-20T20:15:36Z</dc:date>
    <item>
      <title>Adding a date to a string Message</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Adding-a-date-to-a-string-Message/m-p/416287#M119826</link>
      <description>&lt;P&gt;I am trying to create an error message based on a time frame, the last 15 min. and now. So the error message would say, &lt;/P&gt;

&lt;P&gt;"Client Missed file between 15:15:00 - 15:30:00"&lt;/P&gt;

&lt;P&gt;The times are calculated at the time of the search and the following search below fails as "Error in 'eval' command: Typechecking failed. '+' only takes two strings or two numbers."&lt;/P&gt;

&lt;P&gt;| eval 15MinEarly=strftime(relative_time(now(), "-15m"), "%m/%d/%Y %H:%M:%S") &lt;BR /&gt;
| eval Now=strftime(now(), "%m/%d/%Y %H:%M:%S")&lt;BR /&gt;
| eval ErrorMessage = "Client Missed file between: " + 15MinEarly + " - " Now&lt;/P&gt;

&lt;P&gt;How do you convert the two times to string so I can concatenate them into the error message?&lt;/P&gt;</description>
      <pubDate>Mon, 20 Aug 2018 20:15:36 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Adding-a-date-to-a-string-Message/m-p/416287#M119826</guid>
      <dc:creator>griffinpair</dc:creator>
      <dc:date>2018-08-20T20:15:36Z</dc:date>
    </item>
    <item>
      <title>Re: Adding a date to a string Message</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Adding-a-date-to-a-string-Message/m-p/416288#M119827</link>
      <description>&lt;P&gt;Use . for concatenation of strings&lt;/P&gt;

&lt;PRE&gt;
| eval 15MinEarly=strftime(relative_time(now(), "-15m"), "%m/%d/%Y %H:%M:%S") 
| eval Now=strftime(now(), "%m/%d/%Y %H:%M:%S")
| eval ErrorMessage = "Client Missed file between: " .15MinEarly ." - ".Now
&lt;/PRE&gt;</description>
      <pubDate>Mon, 20 Aug 2018 20:22:43 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Adding-a-date-to-a-string-Message/m-p/416288#M119827</guid>
      <dc:creator>pradeepkumarg</dc:creator>
      <dc:date>2018-08-20T20:22:43Z</dc:date>
    </item>
    <item>
      <title>Re: Adding a date to a string Message</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Adding-a-date-to-a-string-Message/m-p/416289#M119828</link>
      <description>&lt;P&gt;I got the following error:&lt;/P&gt;

&lt;P&gt;⚠ Error in 'eval' command: The expression is malformed. &lt;/P&gt;</description>
      <pubDate>Tue, 21 Aug 2018 13:53:10 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Adding-a-date-to-a-string-Message/m-p/416289#M119828</guid>
      <dc:creator>griffinpair</dc:creator>
      <dc:date>2018-08-21T13:53:10Z</dc:date>
    </item>
    <item>
      <title>Re: Adding a date to a string Message</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Adding-a-date-to-a-string-Message/m-p/416290#M119829</link>
      <description>&lt;P&gt;are your fields 15MinEarly and Now working?  try &lt;PRE&gt;| table 15MinEarly Now&lt;/PRE&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 21 Aug 2018 14:04:46 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Adding-a-date-to-a-string-Message/m-p/416290#M119829</guid>
      <dc:creator>pradeepkumarg</dc:creator>
      <dc:date>2018-08-21T14:04:46Z</dc:date>
    </item>
    <item>
      <title>Re: Adding a date to a string Message</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Adding-a-date-to-a-string-Message/m-p/416291#M119830</link>
      <description>&lt;P&gt;Yes. Both fields return expected values.&lt;/P&gt;</description>
      <pubDate>Tue, 21 Aug 2018 14:36:31 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Adding-a-date-to-a-string-Message/m-p/416291#M119830</guid>
      <dc:creator>griffinpair</dc:creator>
      <dc:date>2018-08-21T14:36:31Z</dc:date>
    </item>
    <item>
      <title>Re: Adding a date to a string Message</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Adding-a-date-to-a-string-Message/m-p/416292#M119831</link>
      <description>&lt;P&gt;@griffinpair,&lt;/P&gt;

&lt;P&gt;Is it  ok for you to change the variable name from &lt;CODE&gt;15MinEarly&lt;/CODE&gt; to  &lt;CODE&gt;MinEarly_15&lt;/CODE&gt;? Also change your search to add &lt;CODE&gt;+&lt;/CODE&gt; to the last "Now"&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| eval MinEarly_15=strftime(relative_time(now(), "-15m"), "%m/%d/%Y %H:%M:%S") 
| eval Now=strftime(now(), "%m/%d/%Y %H:%M:%S")
| eval ErrorMessage = "Client Missed file between: " + MinEarly_15 + " - " + Now
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Looks like splunk is bit confused to see  the variables starting with  digits &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 21 Aug 2018 14:57:27 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Adding-a-date-to-a-string-Message/m-p/416292#M119831</guid>
      <dc:creator>renjith_nair</dc:creator>
      <dc:date>2018-08-21T14:57:27Z</dc:date>
    </item>
    <item>
      <title>Re: Adding a date to a string Message</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Adding-a-date-to-a-string-Message/m-p/416293#M119832</link>
      <description>&lt;P&gt;That was exactly the problem. Thanks so much!&lt;/P&gt;</description>
      <pubDate>Tue, 21 Aug 2018 15:03:27 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Adding-a-date-to-a-string-Message/m-p/416293#M119832</guid>
      <dc:creator>griffinpair</dc:creator>
      <dc:date>2018-08-21T15:03:27Z</dc:date>
    </item>
  </channel>
</rss>

