<?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: Logic for looped if greater than statement in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Logic-for-looped-if-greater-than-statement/m-p/574525#M200217</link>
    <description>&lt;P&gt;Maybe you can clarify what is expected from this "nested loop" and how is results from the logic you created so far different from the expectation?&lt;/P&gt;&lt;P&gt;By the way, the last if() statement in your illustration is incomplete in syntax. &amp;nbsp;It should be something like&lt;/P&gt;&lt;P&gt;| eval Then_Set=if(ABC&amp;gt;2500,strftime(strptime(Human_readable,"%B %d, %Y") +86400, "%B %d, %Y"), "none")&lt;/P&gt;&lt;P&gt;For example,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| makeresults

| eval ABC="2800", DEF="3", GHI="5"
| eval rel_Time="11102021"

| eval Epoch_Time=strpTime(rel_Time,"%m%d%Y")
| eval Human_readable=strfTime(Epoch_Time, "%B %d, %Y")

| eval Service=if(ABC&amp;gt;2500, "Send Alert", "No Alert")
| eval Add_1Day=strftime(strptime(Human_readable,"%B %d, %Y") +86400, "%B %d, %Y")
| eval Then_Set=if(ABC&amp;gt;2500,strftime(strptime(Human_readable,"%B %d, %Y") +86400, "%B %d, %Y"), "none")

| table Service Epoch_Time Human_readable Add_1Day Then_Set&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;gets you&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;Service&lt;/TD&gt;&lt;TD&gt;Epoch_Time&lt;/TD&gt;&lt;TD&gt;Human_readable&lt;/TD&gt;&lt;TD&gt;Add_1day&lt;/TD&gt;&lt;TD&gt;Then_Set&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Send Alert&lt;/TD&gt;&lt;TD&gt;1636531200.000000&lt;/TD&gt;&lt;TD&gt;November 10, 2021&lt;/TD&gt;&lt;TD&gt;November 11, 2021&lt;/TD&gt;&lt;TD&gt;November 11, 2021&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;</description>
    <pubDate>Thu, 11 Nov 2021 06:43:31 GMT</pubDate>
    <dc:creator>yuanliu</dc:creator>
    <dc:date>2021-11-11T06:43:31Z</dc:date>
    <item>
      <title>Logic for looped if greater than statement</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Logic-for-looped-if-greater-than-statement/m-p/574521#M200215</link>
      <description>&lt;P&gt;Hey There,&amp;nbsp;&lt;/P&gt;&lt;P&gt;Below I have a field in where ABC &amp;gt; 2500 cuz the value is actually 2800. So then If ABC&amp;gt;than 2500 add 1 day to the Human_readable field. I have already created the logic to adding 1 day to the Human_readable field.... Question now is how can I write the logic for it in a nested loop? So If ABC&amp;gt;2500 add 1 day to human readable.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;This is my logic that I have thus far:&lt;BR /&gt;&lt;BR /&gt;| eval Then_Set=if(ABC&amp;gt;2500,strftime(strptime(Human_readable,"%B %d, %Y") +86400, "%B %d, %Y")&lt;BR /&gt;&lt;BR /&gt;This is what I have so far:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| makeresults

| eval ABC="2800", DEF="3", GHI="5"
| eval rel_Time="11102021"

| eval Epoch_Time=strpTime(rel_Time,"%m%d%Y")
| eval Human_readable=strfTime(Epoch_Time, "%B %d, %Y")

| eval Service=if(ABC&amp;gt;2500, "Send Alert", "No Alert")
| eval Add_1Day=strftime(strptime(Human_readable,"%B %d, %Y") +86400, "%B %d, %Y")
| eval Then_Set=if(ABC&amp;gt;2500,strftime(strptime(Human_readable,"%B %d, %Y") +86400, "%B %d, %Y") 

| table Service Epoch_Time Human_readable Add_1Day Then_Set&lt;/LI-CODE&gt;&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 11 Nov 2021 06:08:52 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Logic-for-looped-if-greater-than-statement/m-p/574521#M200215</guid>
      <dc:creator>MeMilo09</dc:creator>
      <dc:date>2021-11-11T06:08:52Z</dc:date>
    </item>
    <item>
      <title>Re: Logic for looped if greater than statement</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Logic-for-looped-if-greater-than-statement/m-p/574525#M200217</link>
      <description>&lt;P&gt;Maybe you can clarify what is expected from this "nested loop" and how is results from the logic you created so far different from the expectation?&lt;/P&gt;&lt;P&gt;By the way, the last if() statement in your illustration is incomplete in syntax. &amp;nbsp;It should be something like&lt;/P&gt;&lt;P&gt;| eval Then_Set=if(ABC&amp;gt;2500,strftime(strptime(Human_readable,"%B %d, %Y") +86400, "%B %d, %Y"), "none")&lt;/P&gt;&lt;P&gt;For example,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| makeresults

| eval ABC="2800", DEF="3", GHI="5"
| eval rel_Time="11102021"

| eval Epoch_Time=strpTime(rel_Time,"%m%d%Y")
| eval Human_readable=strfTime(Epoch_Time, "%B %d, %Y")

| eval Service=if(ABC&amp;gt;2500, "Send Alert", "No Alert")
| eval Add_1Day=strftime(strptime(Human_readable,"%B %d, %Y") +86400, "%B %d, %Y")
| eval Then_Set=if(ABC&amp;gt;2500,strftime(strptime(Human_readable,"%B %d, %Y") +86400, "%B %d, %Y"), "none")

| table Service Epoch_Time Human_readable Add_1Day Then_Set&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;gets you&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;Service&lt;/TD&gt;&lt;TD&gt;Epoch_Time&lt;/TD&gt;&lt;TD&gt;Human_readable&lt;/TD&gt;&lt;TD&gt;Add_1day&lt;/TD&gt;&lt;TD&gt;Then_Set&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Send Alert&lt;/TD&gt;&lt;TD&gt;1636531200.000000&lt;/TD&gt;&lt;TD&gt;November 10, 2021&lt;/TD&gt;&lt;TD&gt;November 11, 2021&lt;/TD&gt;&lt;TD&gt;November 11, 2021&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;</description>
      <pubDate>Thu, 11 Nov 2021 06:43:31 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Logic-for-looped-if-greater-than-statement/m-p/574525#M200217</guid>
      <dc:creator>yuanliu</dc:creator>
      <dc:date>2021-11-11T06:43:31Z</dc:date>
    </item>
    <item>
      <title>Re: Logic for looped if greater than statement</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Logic-for-looped-if-greater-than-statement/m-p/574670#M200263</link>
      <description>&lt;P&gt;Thanks, basically it was my syntax that was throwing me off... since I had:&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;| eval Then_Set=if(ABC&amp;gt;2500,strftime(strptime(Human_readable,"%B %d, %Y") +86400, "%B %d, %Y")&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;I was not sure of the syntax therefore I was not seeing expected results - and you demonstrated the correct syntax:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;PRE&gt;| eval Then_Set=if(ABC&amp;gt;2500,strftime(strptime(Human_readable,"%B %d, %Y") +86400, "%B %d, %Y"), "none")&lt;/PRE&gt;</description>
      <pubDate>Thu, 11 Nov 2021 23:02:57 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Logic-for-looped-if-greater-than-statement/m-p/574670#M200263</guid>
      <dc:creator>MeMilo09</dc:creator>
      <dc:date>2021-11-11T23:02:57Z</dc:date>
    </item>
  </channel>
</rss>

