<?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: If specified field value does not exist in the current time period do this in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/If-specified-field-value-does-not-exist-in-the-current-time/m-p/578085#M201471</link>
    <description>&lt;P&gt;You are already using if() function. &amp;nbsp;What is the difference between your pseudo code&lt;/P&gt;&lt;BLOCKQUOTE&gt;| eval where FIELD=="value" else&lt;/BLOCKQUOTE&gt;&lt;P&gt;and&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index=sample_idex sourcetype="smf001"
| fields _time,  FIELD
| lookup sample_lookup.csv system as FIELD output sample_env
| eval e=if(in(sample_env, "env"), 1, 0)
| where e=1
| eval FIELD = if(FIELD == "value", FIELD, "display something else")
| table FIELD&lt;/LI-CODE&gt;</description>
    <pubDate>Fri, 10 Dec 2021 21:28:42 GMT</pubDate>
    <dc:creator>yuanliu</dc:creator>
    <dc:date>2021-12-10T21:28:42Z</dc:date>
    <item>
      <title>If specified field value does not exist in the current time period do this</title>
      <link>https://community.splunk.com/t5/Splunk-Search/If-specified-field-value-does-not-exist-in-the-current-time/m-p/578056#M201458</link>
      <description>&lt;P&gt;Hi, hoping to get some more insight on my current problem. My problem is the following&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;I am using a where clause to capture data for a specific field value. If the specific value does not exist for the current time period I get the following message as a result '&lt;SPAN&gt;No results found. Try expanding the time range.' Instead of the no results message showing up I would like to display something else. The following is an example.&lt;BR /&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;index=sample_idex sourcetype="smf001"&lt;BR /&gt;| fields _time,&amp;nbsp; FIELD&lt;BR /&gt;| lookup sample_lookup.csv system as FIELD output sample_env&lt;BR /&gt;| eval e=if(in(sample_env, "env"), 1, 0)&lt;BR /&gt;| where e=1&lt;BR /&gt;| where FIELD=="value"&lt;BR /&gt;| table FIELD&lt;BR /&gt;&lt;BR /&gt;I was thinking of doing something like the following with proper syntax:&lt;BR /&gt;| eval where FIELD=="value" else&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 10 Dec 2021 19:20:47 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/If-specified-field-value-does-not-exist-in-the-current-time/m-p/578056#M201458</guid>
      <dc:creator>splunk3341</dc:creator>
      <dc:date>2021-12-10T19:20:47Z</dc:date>
    </item>
    <item>
      <title>Re: If specified field value does not exist in the current time period do this</title>
      <link>https://community.splunk.com/t5/Splunk-Search/If-specified-field-value-does-not-exist-in-the-current-time/m-p/578078#M201467</link>
      <description>&lt;P&gt;There is no "else" option to the &lt;FONT face="courier new,courier"&gt;where&lt;/FONT&gt; command.&amp;nbsp; The trick to solving this problem is to have a query that produces a result even if no events are found.&amp;nbsp; That's where the &lt;FONT face="courier new,courier"&gt;appendpipe&lt;/FONT&gt; command comes in handy.&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index=sample_idex sourcetype="smf001"
| fields _time,  FIELD
| lookup sample_lookup.csv system as FIELD output sample_env
| eval e=if(in(sample_env, "env"), 1, 0)
| where e=1
| where FIELD=="value"
| appendpipe [ stats count | eval FIELD="something else" | where count=0 | fields - count ]
| table FIELD&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 10 Dec 2021 20:47:10 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/If-specified-field-value-does-not-exist-in-the-current-time/m-p/578078#M201467</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2021-12-10T20:47:10Z</dc:date>
    </item>
    <item>
      <title>Re: If specified field value does not exist in the current time period do this</title>
      <link>https://community.splunk.com/t5/Splunk-Search/If-specified-field-value-does-not-exist-in-the-current-time/m-p/578085#M201471</link>
      <description>&lt;P&gt;You are already using if() function. &amp;nbsp;What is the difference between your pseudo code&lt;/P&gt;&lt;BLOCKQUOTE&gt;| eval where FIELD=="value" else&lt;/BLOCKQUOTE&gt;&lt;P&gt;and&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index=sample_idex sourcetype="smf001"
| fields _time,  FIELD
| lookup sample_lookup.csv system as FIELD output sample_env
| eval e=if(in(sample_env, "env"), 1, 0)
| where e=1
| eval FIELD = if(FIELD == "value", FIELD, "display something else")
| table FIELD&lt;/LI-CODE&gt;</description>
      <pubDate>Fri, 10 Dec 2021 21:28:42 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/If-specified-field-value-does-not-exist-in-the-current-time/m-p/578085#M201471</guid>
      <dc:creator>yuanliu</dc:creator>
      <dc:date>2021-12-10T21:28:42Z</dc:date>
    </item>
  </channel>
</rss>

