<?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: Eval function as result of IF statement in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Eval-function-as-result-of-IF-statement/m-p/659340#M227666</link>
    <description>&lt;P&gt;Perfect&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/139711"&gt;@chris_barrett&lt;/a&gt;&amp;nbsp;.&amp;nbsp; Thanks for the response.&lt;/P&gt;</description>
    <pubDate>Mon, 02 Oct 2023 21:08:11 GMT</pubDate>
    <dc:creator>balcv</dc:creator>
    <dc:date>2023-10-02T21:08:11Z</dc:date>
    <item>
      <title>Eval function as result of IF statement</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Eval-function-as-result-of-IF-statement/m-p/659265#M227651</link>
      <description>&lt;P&gt;Is it possible to have the true and false parts of an if statement contain eval statements.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| eval pwdExpire=if(type="staff", |  eval relative_time(_time, "+90day") , |  eval relative_time(_time, "+180day") ) &lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Desired results is:&lt;BR /&gt;If type="staff" calculate pwdExpiry as _time + 90 days, else calculate pwdExpiry as _time + 180 days.&lt;BR /&gt;&lt;BR /&gt;I will then format pwdExpiry and display in a table.&lt;/P&gt;</description>
      <pubDate>Mon, 02 Oct 2023 03:07:09 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Eval-function-as-result-of-IF-statement/m-p/659265#M227651</guid>
      <dc:creator>balcv</dc:creator>
      <dc:date>2023-10-02T03:07:09Z</dc:date>
    </item>
    <item>
      <title>Re: Eval function as result of IF statement</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Eval-function-as-result-of-IF-statement/m-p/659269#M227652</link>
      <description>&lt;P&gt;The following should do what you want:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| eval pwdExpire = if(type="staff", strftime(relative_time(_time, "+90d"),"%F %T"), strftime(relative_time(_time, "+180d"),"%F %T") )&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You may need to adjust the time format (I've used %F %T) to suit your requirements.&lt;/P&gt;</description>
      <pubDate>Mon, 02 Oct 2023 05:58:38 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Eval-function-as-result-of-IF-statement/m-p/659269#M227652</guid>
      <dc:creator>chris_barrett</dc:creator>
      <dc:date>2023-10-02T05:58:38Z</dc:date>
    </item>
    <item>
      <title>Re: Eval function as result of IF statement</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Eval-function-as-result-of-IF-statement/m-p/659340#M227666</link>
      <description>&lt;P&gt;Perfect&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/139711"&gt;@chris_barrett&lt;/a&gt;&amp;nbsp;.&amp;nbsp; Thanks for the response.&lt;/P&gt;</description>
      <pubDate>Mon, 02 Oct 2023 21:08:11 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Eval-function-as-result-of-IF-statement/m-p/659340#M227666</guid>
      <dc:creator>balcv</dc:creator>
      <dc:date>2023-10-02T21:08:11Z</dc:date>
    </item>
    <item>
      <title>Re: Eval function as result of IF statement</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Eval-function-as-result-of-IF-statement/m-p/659341#M227667</link>
      <description>&lt;P&gt;One additional remark about time manipulation - don't render it to a string unless you are absolutely sure you won't be doing anything else with it. And even better - don't render the _value_ to a string - leave the value in an epoch timestamp but use fieldformat command to only display it rendered to a string.&lt;/P&gt;</description>
      <pubDate>Mon, 02 Oct 2023 21:11:30 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Eval-function-as-result-of-IF-statement/m-p/659341#M227667</guid>
      <dc:creator>PickleRick</dc:creator>
      <dc:date>2023-10-02T21:11:30Z</dc:date>
    </item>
  </channel>
</rss>

