<?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: Using comparison logic to add / remove entries from a lookup table. in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-use-comparison-logic-to-add-remove-entries-from-a-lookup/m-p/630992#M219174</link>
    <description>&lt;P&gt;Sorry one more question. Can I use a field name in the where command?&lt;/P&gt;&lt;P&gt;| eval search_action="login"&lt;/P&gt;&lt;P&gt;| where action!=search_action&lt;/P&gt;&lt;P&gt;I gave it a try but it doesn't appear to work.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 15 Feb 2023 15:33:54 GMT</pubDate>
    <dc:creator>mark_cet</dc:creator>
    <dc:date>2023-02-15T15:33:54Z</dc:date>
    <item>
      <title>How to use comparison logic to add / remove entries from a lookup table?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-use-comparison-logic-to-add-remove-entries-from-a-lookup/m-p/630803#M219127</link>
      <description>&lt;P&gt;Hello again, my apologies for all of these questions.&lt;/P&gt;
&lt;P&gt;I have a lookup table called&amp;nbsp;login_sessions.csv which will keep track of allowed login sessions. It has the following columns UID, sessionstart, and sessionend.&lt;/P&gt;
&lt;P&gt;I would like to add and remove entries to the lookup table depending on the value of a field called "action" in the events.&lt;/P&gt;
&lt;P&gt;If the value of action is "login" then I would like to add the&amp;nbsp;userID,&amp;nbsp;session_start,&amp;nbsp;session_end fields from the event into the&amp;nbsp;login_sessions.csv lookup, and if the value is "logoff" then I would like to remove the existing entry from the lookup.&lt;/P&gt;
&lt;P&gt;I was hoping I could use something like an if or case statement to do this, but I have only seen them used with eval and I haven't had much luck so far.&lt;/P&gt;
&lt;P&gt;E.G.&lt;/P&gt;
&lt;P&gt;if(action=="login", (inputlookup append=true login_sessions.csv | eval UID=userID, sessionstart=session_start, sessionend=session_end | outputlookup login_sessions.csv))&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Is there a way to do this in a search?&lt;/P&gt;
&lt;P&gt;Thank you for any assistance.&lt;/P&gt;</description>
      <pubDate>Tue, 14 Feb 2023 16:35:47 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-use-comparison-logic-to-add-remove-entries-from-a-lookup/m-p/630803#M219127</guid>
      <dc:creator>mark_cet</dc:creator>
      <dc:date>2023-02-14T16:35:47Z</dc:date>
    </item>
    <item>
      <title>Re: Using comparison logic to add / remove entries from a lookup table.</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-use-comparison-logic-to-add-remove-entries-from-a-lookup/m-p/630830#M219134</link>
      <description>&lt;P&gt;SPL does not support branching commands.&amp;nbsp; Branching is only supported within the &lt;FONT face="courier new,courier"&gt;eval&lt;/FONT&gt;, &lt;FONT face="courier new,courier"&gt;where&lt;/FONT&gt;, and &lt;FONT face="courier new,courier"&gt;fieldformat&lt;/FONT&gt; commands.&lt;/P&gt;&lt;P&gt;To remove lines from a lookup table, use the &lt;FONT face="courier new,courier"&gt;where&lt;/FONT&gt; command to filter out unwanted result and write the remainder back to the lookup.&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| inputlookup append=true login_sessions.csv
| where action!="login"
| eval UID=userID, sessionstart=session_start, sessionend=session_end
| outputlookup login_sessions.csv&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 14 Feb 2023 15:42:49 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-use-comparison-logic-to-add-remove-entries-from-a-lookup/m-p/630830#M219134</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2023-02-14T15:42:49Z</dc:date>
    </item>
    <item>
      <title>Re: How to use comparison logic to add / remove entries from a lookup table?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-use-comparison-logic-to-add-remove-entries-from-a-lookup/m-p/630838#M219137</link>
      <description>&lt;P&gt;Perfect, thank you for clarifying!&lt;/P&gt;</description>
      <pubDate>Tue, 14 Feb 2023 16:41:39 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-use-comparison-logic-to-add-remove-entries-from-a-lookup/m-p/630838#M219137</guid>
      <dc:creator>mark_cet</dc:creator>
      <dc:date>2023-02-14T16:41:39Z</dc:date>
    </item>
    <item>
      <title>Re: Using comparison logic to add / remove entries from a lookup table.</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-use-comparison-logic-to-add-remove-entries-from-a-lookup/m-p/630992#M219174</link>
      <description>&lt;P&gt;Sorry one more question. Can I use a field name in the where command?&lt;/P&gt;&lt;P&gt;| eval search_action="login"&lt;/P&gt;&lt;P&gt;| where action!=search_action&lt;/P&gt;&lt;P&gt;I gave it a try but it doesn't appear to work.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 15 Feb 2023 15:33:54 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-use-comparison-logic-to-add-remove-entries-from-a-lookup/m-p/630992#M219174</guid>
      <dc:creator>mark_cet</dc:creator>
      <dc:date>2023-02-15T15:33:54Z</dc:date>
    </item>
    <item>
      <title>Re: Using comparison logic to add / remove entries from a lookup table.</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-use-comparison-logic-to-add-remove-entries-from-a-lookup/m-p/631002#M219179</link>
      <description>&lt;P&gt;Yes, the &lt;FONT face="courier new,courier"&gt;where&lt;/FONT&gt; command supports field names on both sides of the expression (unlike the &lt;FONT face="courier new,courier"&gt;search&lt;/FONT&gt; command).&lt;/P&gt;</description>
      <pubDate>Wed, 15 Feb 2023 16:38:15 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-use-comparison-logic-to-add-remove-entries-from-a-lookup/m-p/631002#M219179</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2023-02-15T16:38:15Z</dc:date>
    </item>
    <item>
      <title>Re: Using comparison logic to add / remove entries from a lookup table.</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-use-comparison-logic-to-add-remove-entries-from-a-lookup/m-p/631395#M219298</link>
      <description>&lt;P&gt;My apologies Rich, I am not able to get this to work if I use field names on both sides of the expression in my where command.&lt;/P&gt;&lt;P&gt;Is there a special way to identify that it is a field and not a value?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;</description>
      <pubDate>Fri, 17 Feb 2023 18:57:10 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-use-comparison-logic-to-add-remove-entries-from-a-lookup/m-p/631395#M219298</guid>
      <dc:creator>mark_cet</dc:creator>
      <dc:date>2023-02-17T18:57:10Z</dc:date>
    </item>
    <item>
      <title>Re: Using comparison logic to add / remove entries from a lookup table.</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-use-comparison-logic-to-add-remove-entries-from-a-lookup/m-p/632015#M219525</link>
      <description>&lt;P&gt;I was not able to get the field names to work in the where command so I had to redo my lookup so I could use static values instead of the field names. The KV Store lookup appears to work much better when removing rows.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks anyways.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 23 Feb 2023 14:57:08 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-use-comparison-logic-to-add-remove-entries-from-a-lookup/m-p/632015#M219525</guid>
      <dc:creator>mark_cet</dc:creator>
      <dc:date>2023-02-23T14:57:08Z</dc:date>
    </item>
  </channel>
</rss>

