<?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 Combine a numerical field with a string field separated with a dash in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Combine-a-numerical-field-with-a-string-field-separated-with-a/m-p/514965#M144554</link>
    <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;I am trying to combine couple of fields data separated by a dash. Tried few options but could not get the expected output.&lt;/P&gt;&lt;P&gt;My query is:&lt;/P&gt;&lt;P&gt;index=test sourcetype="test-abc"&amp;nbsp; ("enter start()")&lt;BR /&gt;| rename job_id as JOB_ID&lt;BR /&gt;| stats earliest(_time) AS Earliest by JOB_ID&lt;BR /&gt;| eval FirstEvent=strftime(Earliest,"%b %d, %Y %H:%M:%S")&lt;BR /&gt;| eval JOB_ID_STR=tostring(JOB_ID)&lt;BR /&gt;| eval JOB-ID-WITH-TIME=printf("%s%z", JOB_ID_STR,FirstEvent)&lt;/P&gt;&lt;P&gt;In the above query: &lt;STRONG&gt;JOB_ID is a numerical data of length 4 digit. FirstEvent is string of time format of that event. &lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Ex:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;JOB_ID = 9000 and&amp;nbsp;FirstEvent =&amp;nbsp;&lt;SPAN&gt;Jul 07, 2020 04:56:43&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;Using the above query and with printf function,&amp;nbsp;&amp;nbsp;&lt;STRONG&gt;JOB-ID-WITH-TIME&lt;/STRONG&gt; is returned as 9000&lt;SPAN&gt;Jul 07, 2020 04:56:43.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;I want the output to be like 9000-Jul 07, 2020 04:56:43 (a dash between JOB_ID and&amp;nbsp;FirstEvent).&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;How to do it?&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Thanks in advance for your time!&lt;/STRONG&gt;&lt;/P&gt;</description>
    <pubDate>Wed, 19 Aug 2020 14:38:59 GMT</pubDate>
    <dc:creator>subhrangshu</dc:creator>
    <dc:date>2020-08-19T14:38:59Z</dc:date>
    <item>
      <title>Combine a numerical field with a string field separated with a dash</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Combine-a-numerical-field-with-a-string-field-separated-with-a/m-p/514965#M144554</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;I am trying to combine couple of fields data separated by a dash. Tried few options but could not get the expected output.&lt;/P&gt;&lt;P&gt;My query is:&lt;/P&gt;&lt;P&gt;index=test sourcetype="test-abc"&amp;nbsp; ("enter start()")&lt;BR /&gt;| rename job_id as JOB_ID&lt;BR /&gt;| stats earliest(_time) AS Earliest by JOB_ID&lt;BR /&gt;| eval FirstEvent=strftime(Earliest,"%b %d, %Y %H:%M:%S")&lt;BR /&gt;| eval JOB_ID_STR=tostring(JOB_ID)&lt;BR /&gt;| eval JOB-ID-WITH-TIME=printf("%s%z", JOB_ID_STR,FirstEvent)&lt;/P&gt;&lt;P&gt;In the above query: &lt;STRONG&gt;JOB_ID is a numerical data of length 4 digit. FirstEvent is string of time format of that event. &lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Ex:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;JOB_ID = 9000 and&amp;nbsp;FirstEvent =&amp;nbsp;&lt;SPAN&gt;Jul 07, 2020 04:56:43&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;Using the above query and with printf function,&amp;nbsp;&amp;nbsp;&lt;STRONG&gt;JOB-ID-WITH-TIME&lt;/STRONG&gt; is returned as 9000&lt;SPAN&gt;Jul 07, 2020 04:56:43.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;I want the output to be like 9000-Jul 07, 2020 04:56:43 (a dash between JOB_ID and&amp;nbsp;FirstEvent).&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;How to do it?&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Thanks in advance for your time!&lt;/STRONG&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 19 Aug 2020 14:38:59 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Combine-a-numerical-field-with-a-string-field-separated-with-a/m-p/514965#M144554</guid>
      <dc:creator>subhrangshu</dc:creator>
      <dc:date>2020-08-19T14:38:59Z</dc:date>
    </item>
    <item>
      <title>Re: Combine a numerical field with a string field separated with a dash</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Combine-a-numerical-field-with-a-string-field-separated-with-a/m-p/514966#M144555</link>
      <description>&lt;P&gt;&lt;SPAN&gt;You can just use eval for that:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;JOB_ID = 9000 and&amp;nbsp;FirstEvent =&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;Jul 07, 2020 04:56:43&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;| eval job_with_time = JOB_ID + "-" + FirstEvent&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 19 Aug 2020 14:43:40 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Combine-a-numerical-field-with-a-string-field-separated-with-a/m-p/514966#M144555</guid>
      <dc:creator>diogofgm</dc:creator>
      <dc:date>2020-08-19T14:43:40Z</dc:date>
    </item>
    <item>
      <title>Re: Combine a numerical field with a string field separated with a dash</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Combine-a-numerical-field-with-a-string-field-separated-with-a/m-p/514975#M144558</link>
      <description>&lt;P&gt;Thanks for the prompt reply. I don't know, how I missed this. Thanks again&amp;nbsp;&lt;span class="lia-unicode-emoji" title=":grinning_face_with_big_eyes:"&gt;😃&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 19 Aug 2020 15:00:50 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Combine-a-numerical-field-with-a-string-field-separated-with-a/m-p/514975#M144558</guid>
      <dc:creator>subhrangshu</dc:creator>
      <dc:date>2020-08-19T15:00:50Z</dc:date>
    </item>
  </channel>
</rss>

