<?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 Concatenate String For Calculated Field? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-To-Concatenate-String-For-Calculated-Field/m-p/125630#M33943</link>
    <description>&lt;P&gt;I tried something like this and worked fine for me (I was able to see the new field)&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;strftime(strptime((YEAR_INI.MONTH_INI.DAY_INI.".".HOUR_INI.MINUTE_INI),"%Y%m%d.%H%M"),"%Y-%m-%d %T")
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Thu, 02 Apr 2015 19:08:06 GMT</pubDate>
    <dc:creator>somesoni2</dc:creator>
    <dc:date>2015-04-02T19:08:06Z</dc:date>
    <item>
      <title>How To Concatenate String For Calculated Field?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-To-Concatenate-String-For-Calculated-Field/m-p/125625#M33938</link>
      <description>&lt;P&gt;Hello everybody, sup?&lt;/P&gt;

&lt;P&gt;I need a little help for this, I have fields separated for a datetime, for example:&lt;/P&gt;

&lt;P&gt;day_ini = 22;&lt;BR /&gt;
mon_ini = 03;&lt;BR /&gt;
year_ini = 2014;&lt;BR /&gt;
hour_ini = 14;&lt;BR /&gt;
minute_ini = 19;&lt;BR /&gt;
second_ini = 03.&lt;/P&gt;

&lt;P&gt;I know we can eval them like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;eval datetime=strftime(strptime((YEAR_INI+""+MONTH_INI+""+DAY_INI+"."+""+HOUR_INI+""+MINUTE_INI),"%Y%m%d.%H%M"),"%Y-%m-%d %T")     
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;In the search query it works perfectly, but when I put this for a calculated field, it doesn't concatenate, so the field is not created.&lt;BR /&gt;
Is there another way I can create this calculated field using this strftime and strptime function together?&lt;/P&gt;

&lt;P&gt;Thanks in advance!&lt;/P&gt;</description>
      <pubDate>Mon, 28 Sep 2020 19:24:24 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-To-Concatenate-String-For-Calculated-Field/m-p/125625#M33938</guid>
      <dc:creator>vtsguerrero</dc:creator>
      <dc:date>2020-09-28T19:24:24Z</dc:date>
    </item>
    <item>
      <title>Re: How To Concatenate String For Calculated Field?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-To-Concatenate-String-For-Calculated-Field/m-p/125626#M33939</link>
      <description>&lt;P&gt;Just forgot to say, this will be a datetime generated from several string fields, this is why I need those functions, and this calculated field should join the strings and convert'em to a datetime...&lt;/P&gt;</description>
      <pubDate>Thu, 02 Apr 2015 17:22:15 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-To-Concatenate-String-For-Calculated-Field/m-p/125626#M33939</guid>
      <dc:creator>vtsguerrero</dc:creator>
      <dc:date>2015-04-02T17:22:15Z</dc:date>
    </item>
    <item>
      <title>Re: How To Concatenate String For Calculated Field?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-To-Concatenate-String-For-Calculated-Field/m-p/125627#M33940</link>
      <description>&lt;P&gt;Can you try the &lt;CODE&gt;.&lt;/CODE&gt; concatenator and see if it changes anything ? &lt;/P&gt;</description>
      <pubDate>Thu, 02 Apr 2015 18:24:13 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-To-Concatenate-String-For-Calculated-Field/m-p/125627#M33940</guid>
      <dc:creator>aljohnson_splun</dc:creator>
      <dc:date>2015-04-02T18:24:13Z</dc:date>
    </item>
    <item>
      <title>Re: How To Concatenate String For Calculated Field?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-To-Concatenate-String-For-Calculated-Field/m-p/125628#M33941</link>
      <description>&lt;P&gt;Still didn't work for the calculated field...&lt;/P&gt;</description>
      <pubDate>Thu, 02 Apr 2015 18:30:37 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-To-Concatenate-String-For-Calculated-Field/m-p/125628#M33941</guid>
      <dc:creator>vtsguerrero</dc:creator>
      <dc:date>2015-04-02T18:30:37Z</dc:date>
    </item>
    <item>
      <title>Re: How To Concatenate String For Calculated Field?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-To-Concatenate-String-For-Calculated-Field/m-p/125629#M33942</link>
      <description>&lt;P&gt;What happens if you do something like:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| eval datetime=strftime(strptime(tostring(YEAR_INI)+tostring(MONTH_INI)+tostring(DAY_INI)+"."+tostring(HOUR_INI)+tostring(MINUTE_INI),"%Y%m%d.%H%M"),"%Y-%m-%d %T")     
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 02 Apr 2015 19:07:59 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-To-Concatenate-String-For-Calculated-Field/m-p/125629#M33942</guid>
      <dc:creator>masonmorales</dc:creator>
      <dc:date>2015-04-02T19:07:59Z</dc:date>
    </item>
    <item>
      <title>Re: How To Concatenate String For Calculated Field?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-To-Concatenate-String-For-Calculated-Field/m-p/125630#M33943</link>
      <description>&lt;P&gt;I tried something like this and worked fine for me (I was able to see the new field)&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;strftime(strptime((YEAR_INI.MONTH_INI.DAY_INI.".".HOUR_INI.MINUTE_INI),"%Y%m%d.%H%M"),"%Y-%m-%d %T")
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 02 Apr 2015 19:08:06 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-To-Concatenate-String-For-Calculated-Field/m-p/125630#M33943</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2015-04-02T19:08:06Z</dc:date>
    </item>
    <item>
      <title>Re: How To Concatenate String For Calculated Field?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-To-Concatenate-String-For-Calculated-Field/m-p/125631#M33944</link>
      <description>&lt;P&gt;Hello, I'm not sure if calculated fields might accept two functions at once, because, I tried both ways and still can't see the new field in search even though I'm sure they fit the same sourcetype:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;DATETIME_TEST01 strftime(strptime((ANO_INI_PV.MES_INI_PV.DIA_INI_PV.".".HORA_INI_PV.MINUTO_INI_PV),"%Y%m%d.%H%M"),"%Y-%m-%d %T")

DATETIME_TEST02 strftime(strptime(tostring(ANO_INI_PV)+tostring(MES_INI_PV)+tostring(DIA_INI_PV)+"."+tostring(HORA_INI_PV)+tostring(MINUTO_INI_PV),"%Y%m%d.%H%M"),"%Y-%m-%d %T")
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Both still didn't work, I dunno what's happening...&lt;/P&gt;</description>
      <pubDate>Mon, 06 Apr 2015 12:54:41 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-To-Concatenate-String-For-Calculated-Field/m-p/125631#M33944</guid>
      <dc:creator>vtsguerrero</dc:creator>
      <dc:date>2015-04-06T12:54:41Z</dc:date>
    </item>
    <item>
      <title>Re: How To Concatenate String For Calculated Field?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-To-Concatenate-String-For-Calculated-Field/m-p/125632#M33945</link>
      <description>&lt;P&gt;Put the exact same way in Calculated Fields, still didn't create the new field... The strange thing is that, if I put the values hard code instead of variables ( MINUTE_INI, ETC ) it works, but if I need to concatenate these, they don't work...&lt;/P&gt;</description>
      <pubDate>Mon, 06 Apr 2015 13:46:05 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-To-Concatenate-String-For-Calculated-Field/m-p/125632#M33945</guid>
      <dc:creator>vtsguerrero</dc:creator>
      <dc:date>2015-04-06T13:46:05Z</dc:date>
    </item>
  </channel>
</rss>

