<?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 merge two field values into one? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-merge-two-field-values-into-one/m-p/201933#M58563</link>
    <description>&lt;P&gt;Try this run anywhere sample. This converts the Valid_Till &amp;amp; current_date format to epoch time&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| gentimes start=-1 | eval x="Oct 7 12:58:21 2016" | eval y=strptime(x, "%b %-d %H:%M:%S %Y") | eval a="08/01/16" | eval b=strptime(a, "%m/%d/%y") | table x y a b
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Tue, 29 Sep 2020 10:29:50 GMT</pubDate>
    <dc:creator>sundareshr</dc:creator>
    <dc:date>2020-09-29T10:29:50Z</dc:date>
    <item>
      <title>How to merge two field values into one?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-merge-two-field-values-into-one/m-p/201932#M58562</link>
      <description>&lt;P&gt;I'm trying to compare two date values, Valid_Till(ex: Oct 7 12:58:21 2016) and the current_date(ex: 08/01/16). In order to create a consistent format, I want to convert Valid_Till to numeric values so that it matches current_date's format. What would be the best way to do this? I've tried using strptime, but it didn't work out.&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 10:27:03 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-merge-two-field-values-into-one/m-p/201932#M58562</guid>
      <dc:creator>jenniferleenyc</dc:creator>
      <dc:date>2020-09-29T10:27:03Z</dc:date>
    </item>
    <item>
      <title>Re: How to merge two field values into one?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-merge-two-field-values-into-one/m-p/201933#M58563</link>
      <description>&lt;P&gt;Try this run anywhere sample. This converts the Valid_Till &amp;amp; current_date format to epoch time&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| gentimes start=-1 | eval x="Oct 7 12:58:21 2016" | eval y=strptime(x, "%b %-d %H:%M:%S %Y") | eval a="08/01/16" | eval b=strptime(a, "%m/%d/%y") | table x y a b
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 29 Sep 2020 10:29:50 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-merge-two-field-values-into-one/m-p/201933#M58563</guid>
      <dc:creator>sundareshr</dc:creator>
      <dc:date>2020-09-29T10:29:50Z</dc:date>
    </item>
    <item>
      <title>Re: How to merge two field values into one?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-merge-two-field-values-into-one/m-p/201934#M58564</link>
      <description>&lt;P&gt;What was the search you tried?&lt;/P&gt;

&lt;P&gt;Something like below should work&lt;/P&gt;

&lt;PRE&gt; | eval Valid_Till_epoch = strptime(Valid_Till, "%b %d %H:%M:%S %Y") &lt;/PRE&gt;</description>
      <pubDate>Mon, 01 Aug 2016 20:25:07 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-merge-two-field-values-into-one/m-p/201934#M58564</guid>
      <dc:creator>pradeepkumarg</dc:creator>
      <dc:date>2016-08-01T20:25:07Z</dc:date>
    </item>
    <item>
      <title>Re: How to merge two field values into one?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-merge-two-field-values-into-one/m-p/201935#M58565</link>
      <description>&lt;P&gt;Hi jenniferleenyc,&lt;/P&gt;

&lt;P&gt;take this run everywhere search :&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| gentimes start=-1
| eval foo1="Oct 7 12:58:21 2016", foo2="08/01/16" 
| eval boo1=strptime(foo1, "%b %e %H:%M:%S %Y"), boo2=strptime(foo2, "%m/%d/%y") 
| table foo1 foo2 boo1 boo2
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;This will create some dummy fields and using &lt;CODE&gt;strptime&lt;/CODE&gt; you will parse the values of &lt;CODE&gt;foo1&lt;/CODE&gt; and &lt;CODE&gt;foo2&lt;/CODE&gt; into epoch values which later can be compared. See the docs on &lt;CODE&gt;strptime&lt;/CODE&gt; &lt;A href="http://docs.splunk.com/Documentation/Splunk/6.4.2/SearchReference/CommonEvalFunctions#Date_and_Time_functions"&gt;http://docs.splunk.com/Documentation/Splunk/6.4.2/SearchReference/CommonEvalFunctions#Date_and_Time_functions&lt;/A&gt;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; This function takes a time represented by a string, X, and parses it into a timestamp using the format specified by Y.
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;For more information on the time format option see &lt;A href="http://docs.splunk.com/Documentation/Splunk/6.4.2/SearchReference/Commontimeformatvariables"&gt;http://docs.splunk.com/Documentation/Splunk/6.4.2/SearchReference/Commontimeformatvariables&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;Hope this helps ...&lt;/P&gt;

&lt;P&gt;cheers, MuS&lt;/P&gt;</description>
      <pubDate>Mon, 01 Aug 2016 20:32:25 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-merge-two-field-values-into-one/m-p/201935#M58565</guid>
      <dc:creator>MuS</dc:creator>
      <dc:date>2016-08-01T20:32:25Z</dc:date>
    </item>
  </channel>
</rss>

