<?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 lookups to categorize field values into certain categories, how do I prepare for a field value that is not in the lookup? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Using-lookups-to-categorize-field-values-into-certain-categories/m-p/190422#M54833</link>
    <description>&lt;P&gt;Interesting, it might be a bug on the release, works over here... anyway, sticky with fillnull for now.&lt;/P&gt;

&lt;P&gt;Cheers&lt;/P&gt;</description>
    <pubDate>Mon, 23 Mar 2015 23:46:55 GMT</pubDate>
    <dc:creator>musskopf</dc:creator>
    <dc:date>2015-03-23T23:46:55Z</dc:date>
    <item>
      <title>Using lookups to categorize field values into certain categories, how do I prepare for a field value that is not in the lookup?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Using-lookups-to-categorize-field-values-into-certain-categories/m-p/190409#M54820</link>
      <description>&lt;P&gt;I am thinking of using lookups for categorizing field values into certain categories, as below. Using lookups is probably the way I will go, as thus far this seems to be the best option?&lt;/P&gt;

&lt;P&gt;But what I want to prepare for is the when a new fieldname is introduced lets say &lt;CODE&gt;fieldName5&lt;/CODE&gt; or anything other than &lt;CODE&gt;fieldName1-4&lt;/CODE&gt; and map it to Category &lt;CODE&gt;Cat_Undefined&lt;/CODE&gt;. Is there a way I would be able to do this?&lt;/P&gt;

&lt;P&gt;A simple example:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;fieldName,Category
fieldName1,Cat1
fieldName2,Cat2
fieldName3,Cat3
fieldName4,Cat4
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 20 Mar 2015 03:02:13 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Using-lookups-to-categorize-field-values-into-certain-categories/m-p/190409#M54820</guid>
      <dc:creator>HattrickNZ</dc:creator>
      <dc:date>2015-03-20T03:02:13Z</dc:date>
    </item>
    <item>
      <title>Re: Using lookups to categorize field values into certain categories, how do I prepare for a field value that is not in the lookup?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Using-lookups-to-categorize-field-values-into-certain-categories/m-p/190410#M54821</link>
      <description>&lt;P&gt;Yes, once you create your lookup definition you should define the "Default matches" to "Cat_Undefined", that will be the default value. Alternatively, you could use the &lt;CODE&gt;fillnull&lt;/CODE&gt; command after the lookup.&lt;/P&gt;</description>
      <pubDate>Fri, 20 Mar 2015 05:35:55 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Using-lookups-to-categorize-field-values-into-certain-categories/m-p/190410#M54821</guid>
      <dc:creator>musskopf</dc:creator>
      <dc:date>2015-03-20T05:35:55Z</dc:date>
    </item>
    <item>
      <title>Re: Using lookups to categorize field values into certain categories, how do I prepare for a field value that is not in the lookup?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Using-lookups-to-categorize-field-values-into-certain-categories/m-p/190411#M54822</link>
      <description>&lt;P&gt;Hi HattrickNZ&lt;BR /&gt;
try this query &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;source=........  fieldName=fieldName1 OR  fieldName=fieldName2 OR  fieldName=fieldName3  OR  fieldName=fieldName4 | table fieldName Category | append[search source=...... fieldName!=fieldName1 AND fieldName!=fieldName2 AND  fieldName!=fieldName3  AND fieldName!=fieldName4 | fillnull value=Cat_Undefined category ]|table fieldName Category
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;tell me if it satisfy you &lt;/P&gt;</description>
      <pubDate>Fri, 20 Mar 2015 13:16:31 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Using-lookups-to-categorize-field-values-into-certain-categories/m-p/190411#M54822</guid>
      <dc:creator>chimell</dc:creator>
      <dc:date>2015-03-20T13:16:31Z</dc:date>
    </item>
    <item>
      <title>Re: Using lookups to categorize field values into certain categories, how do I prepare for a field value that is not in the lookup?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Using-lookups-to-categorize-field-values-into-certain-categories/m-p/190412#M54823</link>
      <description>&lt;BLOCKQUOTE&gt;
&lt;P&gt;you should define the "Default&lt;BR /&gt;
matches" to "Cat_Undefined", that will&lt;BR /&gt;
be the default value.&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;

&lt;P&gt;How do i do this exactly? Is this somehow done when I am uploading my csv file with the lookups? tks&lt;/P&gt;</description>
      <pubDate>Sun, 22 Mar 2015 19:55:16 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Using-lookups-to-categorize-field-values-into-certain-categories/m-p/190412#M54823</guid>
      <dc:creator>HattrickNZ</dc:creator>
      <dc:date>2015-03-22T19:55:16Z</dc:date>
    </item>
    <item>
      <title>Re: Using lookups to categorize field values into certain categories, how do I prepare for a field value that is not in the lookup?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Using-lookups-to-categorize-field-values-into-certain-categories/m-p/190413#M54824</link>
      <description>&lt;P&gt;You should go to "Settings -&amp;gt; Lookups" and click over "Lookup Definitions". It sounds that you already uploaded the CSV file, so just need to create a new definition. Give it a name, select the uploaded file and click "Advanced Options". There you should define, for example, minimum: 1, maximum: 1 and default matches: "CAT Undefined". basically Splunk will use this value to populate everything without a match on your CSV file.&lt;/P&gt;

&lt;P&gt;Remember now to use you Lookup Definition once you use the &lt;CODE&gt;lookup&lt;/CODE&gt; command, and not the CSV file.&lt;/P&gt;</description>
      <pubDate>Mon, 23 Mar 2015 05:09:39 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Using-lookups-to-categorize-field-values-into-certain-categories/m-p/190413#M54824</guid>
      <dc:creator>musskopf</dc:creator>
      <dc:date>2015-03-23T05:09:39Z</dc:date>
    </item>
    <item>
      <title>Re: Using lookups to categorize field values into certain categories, how do I prepare for a field value that is not in the lookup?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Using-lookups-to-categorize-field-values-into-certain-categories/m-p/190414#M54825</link>
      <description>&lt;P&gt;I can't get the &lt;CODE&gt;lookup&lt;/CODE&gt; to work...&lt;BR /&gt;
but i have my search &lt;CODE&gt;stats values(fieldName) by Category&lt;/CODE&gt; &lt;BR /&gt;
and this gives me something like:&lt;BR /&gt;
 fieldName,Category&lt;BR /&gt;
fieldName1,Cat1&lt;BR /&gt;
fieldName2,Cat2&lt;BR /&gt;
fieldName3,Cat3&lt;BR /&gt;
fieldName4,Cat4&lt;/P&gt;

&lt;P&gt;but it is not picking up the &lt;CODE&gt;fieldName5&lt;/CODE&gt; that I want to show as &lt;CODE&gt;CAT Undefined&lt;/CODE&gt; after doing what you said with the min/max/default. Am I doing something Wrong?&lt;/P&gt;

&lt;P&gt;So what I want to see is:&lt;BR /&gt;
     fieldName,Category&lt;BR /&gt;
    fieldName1,Cat1&lt;BR /&gt;
    fieldName2,Cat2&lt;BR /&gt;
    fieldName3,Cat3&lt;BR /&gt;
    fieldName4,Cat4&lt;BR /&gt;
    fieldName5,CAT Undefined&lt;/P&gt;</description>
      <pubDate>Mon, 23 Mar 2015 22:12:46 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Using-lookups-to-categorize-field-values-into-certain-categories/m-p/190414#M54825</guid>
      <dc:creator>HattrickNZ</dc:creator>
      <dc:date>2015-03-23T22:12:46Z</dc:date>
    </item>
    <item>
      <title>Re: Using lookups to categorize field values into certain categories, how do I prepare for a field value that is not in the lookup?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Using-lookups-to-categorize-field-values-into-certain-categories/m-p/190415#M54826</link>
      <description>&lt;P&gt;Paste here the full search command you're using...&lt;/P&gt;</description>
      <pubDate>Mon, 23 Mar 2015 22:15:20 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Using-lookups-to-categorize-field-values-into-certain-categories/m-p/190415#M54826</guid>
      <dc:creator>musskopf</dc:creator>
      <dc:date>2015-03-23T22:15:20Z</dc:date>
    </item>
    <item>
      <title>Re: Using lookups to categorize field values into certain categories, how do I prepare for a field value that is not in the lookup?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Using-lookups-to-categorize-field-values-into-certain-categories/m-p/190416#M54827</link>
      <description>&lt;P&gt;not sure I follow? Do I use lookups here?&lt;/P&gt;</description>
      <pubDate>Mon, 23 Mar 2015 22:22:18 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Using-lookups-to-categorize-field-values-into-certain-categories/m-p/190416#M54827</guid>
      <dc:creator>HattrickNZ</dc:creator>
      <dc:date>2015-03-23T22:22:18Z</dc:date>
    </item>
    <item>
      <title>Re: Using lookups to categorize field values into certain categories, how do I prepare for a field value that is not in the lookup?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Using-lookups-to-categorize-field-values-into-certain-categories/m-p/190417#M54828</link>
      <description>&lt;P&gt;&lt;CODE&gt;index=_internal sourcetype="splunk_web_access" | stats values(status) by value2replacelookup_RHS_2takenOut_CatchThis&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;gives me:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;value2replacelookup_RHS_2takenOut_CatchThis     values(status)
Aaaaa   200
Bbbbb   304
Ccccc   303 
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I have remove these 2 lines from my lookup table that i uploaded to splunk &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;Ddddd   400
Eeeee   404 
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;So I want to somehow know that &lt;CODE&gt;400&lt;/CODE&gt; and &lt;CODE&gt;404&lt;/CODE&gt; are there.&lt;/P&gt;</description>
      <pubDate>Mon, 23 Mar 2015 22:25:54 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Using-lookups-to-categorize-field-values-into-certain-categories/m-p/190417#M54828</guid>
      <dc:creator>HattrickNZ</dc:creator>
      <dc:date>2015-03-23T22:25:54Z</dc:date>
    </item>
    <item>
      <title>Re: Using lookups to categorize field values into certain categories, how do I prepare for a field value that is not in the lookup?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Using-lookups-to-categorize-field-values-into-certain-categories/m-p/190418#M54829</link>
      <description>&lt;P&gt;Sorry, I don't get where is the &lt;CODE&gt;lookup&lt;/CODE&gt; command on your search... you need to try something like:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=_internal sourcetype="splunk_web_access" | lookup MY_LOOKUP status | stats count by msg
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Now the MY_LOOKUP is the definition name you created using a CSV file like:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;status,msg
200,OK
404,NOT_FOUND
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;An alternative if that isn't working is just use &lt;CODE&gt;fillnull&lt;/CODE&gt;, like that:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=_internal sourcetype="splunk_web_access" | lookup MY_LOOKUP status | fillnull value="Not Resolved" msg | stats count by msg
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;This should populate all events without the msg field with "Not Resolved"&lt;/P&gt;</description>
      <pubDate>Mon, 23 Mar 2015 22:34:02 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Using-lookups-to-categorize-field-values-into-certain-categories/m-p/190418#M54829</guid>
      <dc:creator>musskopf</dc:creator>
      <dc:date>2015-03-23T22:34:02Z</dc:date>
    </item>
    <item>
      <title>Re: Using lookups to categorize field values into certain categories, how do I prepare for a field value that is not in the lookup?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Using-lookups-to-categorize-field-values-into-certain-categories/m-p/190419#M54830</link>
      <description>&lt;P&gt;&lt;CODE&gt;index=_internal sourcetype="splunk_web_access" | lookup ABasicLookupFoSplunkOnMyMachine_2takenOutButCatchThis.csv value2lookup | fillnull value="Not Resolved" value2replacelookup | stats count by value2replacelookup&lt;/CODE&gt;&lt;BR /&gt;
gives me:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;value2replacelookup     count
Not Resolved    2658
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;&lt;CODE&gt;index=_internal sourcetype="splunk_web_access" | lookup ABasicLookupFoSplunkOnMyMachine_2takenOutButCatchThis.csv value2lookup | fillnull value="Not Resolved" value2replacelookup | stats values(status) by value2replacelookup_RHS_2takenOut_CatchThis&lt;/CODE&gt;&lt;BR /&gt;
gives me(but it is not showing the undefined values)&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;value2replacelookup_RHS_2takenOut_CatchThis     values(status)
Aaaaa   200
Bbbbb   304
Ccccc   303 
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 23 Mar 2015 23:16:41 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Using-lookups-to-categorize-field-values-into-certain-categories/m-p/190419#M54830</guid>
      <dc:creator>HattrickNZ</dc:creator>
      <dc:date>2015-03-23T23:16:41Z</dc:date>
    </item>
    <item>
      <title>Re: Using lookups to categorize field values into certain categories, how do I prepare for a field value that is not in the lookup?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Using-lookups-to-categorize-field-values-into-certain-categories/m-p/190420#M54831</link>
      <description>&lt;P&gt;You are confusing thing, let's try to clarify:&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;STATS&lt;/STRONG&gt;&lt;BR /&gt;
when using &lt;CODE&gt;stats by&lt;/CODE&gt;, the stats will only group things by the selected field, if the field is present.&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;FILLNULL&lt;/STRONG&gt;&lt;BR /&gt;
The &lt;CODE&gt;fillnull&lt;/CODE&gt; command creates value for fields that don't exist on the event, by default it populates with "0", but you can speficy any value.&lt;/P&gt;

&lt;P&gt;Now, if you look your searches, the first thing I noticed is the lookup command.  Looks like you're using the CSV file instead of the lookup definition, that's the reason why the "Default Value" from the lookup definition is not been used. Well, ignoring that and focusing on the fillnull only, at the second command, you're grouping by "value2replacelookup_RHS_2takenOut_CatchThis", but your &lt;CODE&gt;fillnull&lt;/CODE&gt; is populating "value2replacelookup". Try update it like that:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=_internal sourcetype="splunk_web_access" | lookup ABasicLookupFoSplunkOnMyMachine_2takenOutButCatchThis.csv value2lookup | fillnull value="Not Resolved" value2replacelookup_RHS_2takenOut_CatchThis | stats values(status) by value2replacelookup_RHS_2takenOut_CatchThis
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 28 Sep 2020 19:19:59 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Using-lookups-to-categorize-field-values-into-certain-categories/m-p/190420#M54831</guid>
      <dc:creator>musskopf</dc:creator>
      <dc:date>2020-09-28T19:19:59Z</dc:date>
    </item>
    <item>
      <title>Re: Using lookups to categorize field values into certain categories, how do I prepare for a field value that is not in the lookup?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Using-lookups-to-categorize-field-values-into-certain-categories/m-p/190421#M54832</link>
      <description>&lt;P&gt;Thats it. That search works. Thanks very much. And apologies for the brutalness of my question!!&lt;BR /&gt;
Yes that is using the csv file. And it gives me this.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;value2replacelookup_RHS_2takenOut_CatchThis     values(status)
Aaaaa   200
Bbbbb   304
Ccccc   303
Not Resolved    400
                 404 
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;But this works the same:(this is using the lookup I defined with the same csv file, but i have to use &lt;CODE&gt;fillnull&lt;/CODE&gt; here)&lt;BR /&gt;
&lt;CODE&gt;index=_internal sourcetype="splunk_web_access" | lookup ABasicLookupFoSplunkOnMyMachine_2takenOutButCatchThis_lookup value2lookup | fillnull value="Not Resolved" value2replacelookup_RHS_2takenOut_CatchThis | stats values(status) by value2replacelookup_RHS_2takenOut_CatchThis&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;If i don't use &lt;CODE&gt;fillnull&lt;/CODE&gt;I thought the &lt;CODE&gt;min/max/default = 1/1/"CAT Undefined"&lt;/CODE&gt; would work but it does not seem to as it gives me this &lt;BR /&gt;
&lt;CODE&gt;index=_internal sourcetype="splunk_web_access" | lookup ABasicLookupFoSplunkOnMyMachine_2takenOutButCatchThis_lookup value2lookup | stats values(status) by value2replacelookup_RHS_2takenOut_CatchThis&lt;/CODE&gt;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;value2replacelookup_RHS_2takenOut_CatchThis     values(status)
Aaaaa   200
Bbbbb   304
Ccccc   303 
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 23 Mar 2015 23:42:20 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Using-lookups-to-categorize-field-values-into-certain-categories/m-p/190421#M54832</guid>
      <dc:creator>HattrickNZ</dc:creator>
      <dc:date>2015-03-23T23:42:20Z</dc:date>
    </item>
    <item>
      <title>Re: Using lookups to categorize field values into certain categories, how do I prepare for a field value that is not in the lookup?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Using-lookups-to-categorize-field-values-into-certain-categories/m-p/190422#M54833</link>
      <description>&lt;P&gt;Interesting, it might be a bug on the release, works over here... anyway, sticky with fillnull for now.&lt;/P&gt;

&lt;P&gt;Cheers&lt;/P&gt;</description>
      <pubDate>Mon, 23 Mar 2015 23:46:55 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Using-lookups-to-categorize-field-values-into-certain-categories/m-p/190422#M54833</guid>
      <dc:creator>musskopf</dc:creator>
      <dc:date>2015-03-23T23:46:55Z</dc:date>
    </item>
  </channel>
</rss>

