<?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 get an &amp;quot;eval if else&amp;quot; condition to continue a search depending on the resulting field? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-get-an-quot-eval-if-else-quot-condition-to-continue-a/m-p/222961#M65572</link>
    <description>&lt;P&gt;Thanks &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt; helped me.&lt;/P&gt;</description>
    <pubDate>Fri, 12 Aug 2016 12:46:09 GMT</pubDate>
    <dc:creator>gamification</dc:creator>
    <dc:date>2016-08-12T12:46:09Z</dc:date>
    <item>
      <title>How to get an "eval if else" condition to continue a search depending on the resulting field?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-get-an-quot-eval-if-else-quot-condition-to-continue-a/m-p/222959#M65570</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;

&lt;P&gt;I would like to know if it's possible to do certain part of search with if statement on a field.&lt;/P&gt;

&lt;P&gt;For example:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index="test" | head 1 | eval field = lastUpdate ((lastUpdate is an extracted field)) | eval date = strptime( field ,"%Y.%m.%d %H:%M.%S")
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;The problem here is field is sometimes null, sometimes not, so strptime may not work correctly. So what I would like to do is:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index="test | head 1 | eval field = lastUpdate | if field ="2014.01.12" ----&amp;gt; parse it | else .....
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Don't focus on my example, the thing that I don't understand is how to do the if else.&lt;/P&gt;

&lt;P&gt;Thanks for help.&lt;/P&gt;</description>
      <pubDate>Thu, 11 Aug 2016 16:39:43 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-get-an-quot-eval-if-else-quot-condition-to-continue-a/m-p/222959#M65570</guid>
      <dc:creator>gamification</dc:creator>
      <dc:date>2016-08-11T16:39:43Z</dc:date>
    </item>
    <item>
      <title>Re: How to get an "eval if else" condition to continue a search depending on the resulting field?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-get-an-quot-eval-if-else-quot-condition-to-continue-a/m-p/222960#M65571</link>
      <description>&lt;P&gt;Try this&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index="test" | head 1 | eval field = lastUpdate ((lastUpdate is an extracted field)) | eval date = if(isnotnull(field),strptime( field ,"%Y.%m.%d %H:%M.%S"),now())
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;OR&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index="test" lastUpdate=* | eval field = lastUpdate ((lastUpdate is an extracted field)) | eval date = strptime( field ,"%Y.%m.%d %H:%M.%S")
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 11 Aug 2016 17:23:54 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-get-an-quot-eval-if-else-quot-condition-to-continue-a/m-p/222960#M65571</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2016-08-11T17:23:54Z</dc:date>
    </item>
    <item>
      <title>Re: How to get an "eval if else" condition to continue a search depending on the resulting field?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-get-an-quot-eval-if-else-quot-condition-to-continue-a/m-p/222961#M65572</link>
      <description>&lt;P&gt;Thanks &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt; helped me.&lt;/P&gt;</description>
      <pubDate>Fri, 12 Aug 2016 12:46:09 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-get-an-quot-eval-if-else-quot-condition-to-continue-a/m-p/222961#M65572</guid>
      <dc:creator>gamification</dc:creator>
      <dc:date>2016-08-12T12:46:09Z</dc:date>
    </item>
  </channel>
</rss>

