<?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: Handling nulls in a string in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Handling-nulls-in-a-string/m-p/697017#M236846</link>
    <description>&lt;P&gt;and from a purely SPL point of view, technically you could do any of these to fill the null values.&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| foreach domain_id domain_name group non_tier_zero_principal path_id path_title principal tier_zero_principal user [
   | fillnull "&amp;lt;&amp;lt;FIELD&amp;gt;&amp;gt;" value="NULL_&amp;lt;&amp;lt;FIELD&amp;gt;&amp;gt;"
]

OR 

| foreach domain_id domain_name group non_tier_zero_principal path_id path_title principal tier_zero_principal user [
   | eval &amp;lt;&amp;lt;FIELD&amp;gt;&amp;gt;=if(isnull('&amp;lt;&amp;lt;FIELD&amp;gt;&amp;gt;'), "NULL_&amp;lt;&amp;lt;FIELD&amp;gt;&amp;gt;", '&amp;lt;&amp;lt;FIELD&amp;gt;&amp;gt;')
]

OR

| fillnull domain_id domain_name group non_tier_zero_principal path_id path_title principal tier_zero_principal user value="NULL"&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 22 Aug 2024 01:22:07 GMT</pubDate>
    <dc:creator>bowesmana</dc:creator>
    <dc:date>2024-08-22T01:22:07Z</dc:date>
    <item>
      <title>Handling nulls in a string</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Handling-nulls-in-a-string/m-p/696894#M236825</link>
      <description>&lt;P&gt;I've got this search&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index=my_index data_type=my_sourcetype earliest=-15m latest=now
| eval domain_id=if(isnull(domain_id), "NULL_domain_id", domain_id) 
| eval domain_name=if(isnull(domain_name), "NULL_domain_name", domain_name) 
| eval group=if(isnull(group), "NULL_Group", group) 
| eval non_tier_zero_principal=if(isnull(non_tier_zero_principal), "NULL_non_tier_zero_principal", non_tier_zero_principal) 
| eval path_id=if(isnull(path_id), "NULL_path_id", path_id) 
| eval path_title=if(isnull(path_title), "NULL_path_title", path_title) 
| eval principal=if(isnull(principal), "NULL_principal", principal) 
| eval tier_zero_principal=if(isnull(tier_zero_principal), "NULL_tier_zero_principal", tier_zero_principal) 
| eval user=if(isnull(user), "NULL_user", user) 
| eval key=sha512(domain_id.domain_name.group.non_tier_zero_principal.path_id.path_title.principal.tier_zero_principal.tier_zero_principal.user) 
| table domain_id, domain_name, group, non_tier_zero_principal, path_id, path_title, principla, tier_zero_principal, user, key&lt;/LI-CODE&gt;&lt;P&gt;Due to the fact that we get repeating events where the only difference is the timestamp, I'm trying to put together a lookup that contains the sha512 key and that will allow an event to be skipped.&amp;nbsp; What I found is I can't have a blank value in the sha512 command.&amp;nbsp; Does anyone have a better way of doing this, then what I have?&lt;/P&gt;&lt;P&gt;TIA,&lt;/P&gt;&lt;P&gt;Joe&lt;/P&gt;</description>
      <pubDate>Tue, 20 Aug 2024 21:39:36 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Handling-nulls-in-a-string/m-p/696894#M236825</guid>
      <dc:creator>jwhughes58</dc:creator>
      <dc:date>2024-08-20T21:39:36Z</dc:date>
    </item>
    <item>
      <title>Re: Handling nulls in a string</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Handling-nulls-in-a-string/m-p/696915#M236829</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/172955"&gt;@jwhughes58&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;instead of using the lookup, why don't you dedup for all fields contained in your events?&lt;/P&gt;&lt;P&gt;or take a portion of _raw (excluding the timestamp) and dedup fot it?&lt;/P&gt;&lt;P&gt;Ciao.&lt;/P&gt;&lt;P&gt;Giuseppe&lt;/P&gt;</description>
      <pubDate>Wed, 21 Aug 2024 06:14:09 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Handling-nulls-in-a-string/m-p/696915#M236829</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2024-08-21T06:14:09Z</dc:date>
    </item>
    <item>
      <title>Re: Handling nulls in a string</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Handling-nulls-in-a-string/m-p/696977#M236836</link>
      <description>&lt;P&gt;Buongiorno Giuseppe,&lt;/P&gt;&lt;P&gt;I see what you are saying, but I don't think that will work.&amp;nbsp; Here is what is in an event.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;{"timestamp": "2024-08-20 15:30:00.837000", "data_type": "finding_export", "domain_id": "my_domain_id", "domain_name": "my_domain_name", "path_id": "T0MarkSensitive", "path_title": "My Path Title", "user": "my_user"}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Every 15 minutes the binary goes to the API and pulls events.&amp;nbsp; Most of the events are duplicates except for the timestamp.&amp;nbsp; There may or may not be a new event which needs to be alerted on.&amp;nbsp; The monitoring team doesn't want to see any duplication, thus the lookup to save what has already come through.&lt;/P&gt;&lt;P&gt;Now the issue is that not all the fields have values all the time.&amp;nbsp; When a field has no value the SHA256 command doesn't work.&amp;nbsp; Which is why I asked is there a better way than doing isnull on each field.&lt;/P&gt;&lt;P&gt;Ciao,&lt;/P&gt;&lt;P&gt;Joe&lt;/P&gt;</description>
      <pubDate>Wed, 21 Aug 2024 16:31:48 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Handling-nulls-in-a-string/m-p/696977#M236836</guid>
      <dc:creator>jwhughes58</dc:creator>
      <dc:date>2024-08-21T16:31:48Z</dc:date>
    </item>
    <item>
      <title>Re: Handling nulls in a string</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Handling-nulls-in-a-string/m-p/697011#M236842</link>
      <description>&lt;P&gt;Do you understand WHY you are getting duplicates from the API?&lt;/P&gt;&lt;P&gt;At what point would you want a 'new' event not to be treated as a duplicate? Forever? Last 60 minutes?&lt;/P&gt;&lt;P&gt;Depending on that, you could make your alert look back at a longer time window and aggregate common events together with first and last timers and then ignore any 'new' events in the window you are interested in that have a count &amp;gt; 1 in the larger window.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 22 Aug 2024 01:08:03 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Handling-nulls-in-a-string/m-p/697011#M236842</guid>
      <dc:creator>bowesmana</dc:creator>
      <dc:date>2024-08-22T01:08:03Z</dc:date>
    </item>
    <item>
      <title>Re: Handling nulls in a string</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Handling-nulls-in-a-string/m-p/697017#M236846</link>
      <description>&lt;P&gt;and from a purely SPL point of view, technically you could do any of these to fill the null values.&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| foreach domain_id domain_name group non_tier_zero_principal path_id path_title principal tier_zero_principal user [
   | fillnull "&amp;lt;&amp;lt;FIELD&amp;gt;&amp;gt;" value="NULL_&amp;lt;&amp;lt;FIELD&amp;gt;&amp;gt;"
]

OR 

| foreach domain_id domain_name group non_tier_zero_principal path_id path_title principal tier_zero_principal user [
   | eval &amp;lt;&amp;lt;FIELD&amp;gt;&amp;gt;=if(isnull('&amp;lt;&amp;lt;FIELD&amp;gt;&amp;gt;'), "NULL_&amp;lt;&amp;lt;FIELD&amp;gt;&amp;gt;", '&amp;lt;&amp;lt;FIELD&amp;gt;&amp;gt;')
]

OR

| fillnull domain_id domain_name group non_tier_zero_principal path_id path_title principal tier_zero_principal user value="NULL"&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 22 Aug 2024 01:22:07 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Handling-nulls-in-a-string/m-p/697017#M236846</guid>
      <dc:creator>bowesmana</dc:creator>
      <dc:date>2024-08-22T01:22:07Z</dc:date>
    </item>
    <item>
      <title>Re: Handling nulls in a string</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Handling-nulls-in-a-string/m-p/697024#M236851</link>
      <description>&lt;P&gt;I agree with&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/161352"&gt;@gcusello&lt;/a&gt;&amp;nbsp;that dedup should suffice because dedup really performs on the same principle. &amp;nbsp;But before going into code, you need to define what you are looking for using data illustrations. &amp;nbsp;Without such definition, we could be talking across each other.&lt;/P&gt;&lt;P&gt;So, assuming that you have these raw events&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;_raw&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;{"timestamp":"2024-08-20 15:33:00.837000","data_type":"finding_export","domain_id":"my_domain_id","domain_name":"my_domain_name","path_id":"T0MarkSensitive","path_title":"My Path Title","user":"my_user"}&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;2&lt;/TD&gt;&lt;TD&gt;{"timestamp":"2024-08-20 15:32:00.837000","data_type":"finding_export","domain_id":"your_domain_id","domain_name":"your_domain_name","path_id":"T0MarkSensitive","path_title":"My Path Title","user":"my_user"}&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;3&lt;/TD&gt;&lt;TD&gt;{"timestamp":"2024-08-20 15:31:10.837000","data_type":"finding_export","domain_id":"my_domain_id","path_id":"T0MarkSensitive","path_title":"My Path Title","user":"your_user"}&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;4&lt;/TD&gt;&lt;TD&gt;{"timestamp":"2024-08-20 15:31:05.837000","data_type":"finding_export","domain_id":"my_domain_id","path_id":"T0MarkSensitive","path_title":"My Path Title","user":"my_user"}&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;5&lt;/TD&gt;&lt;TD&gt;{"timestamp":"2024-08-20 15:31:00.837000","data_type":"finding_export","domain_id":"my_domain_id","path_id":"T0MarkSensitive","path_title":"My Path Title","user":"my_user"}&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;6&lt;/TD&gt;&lt;TD&gt;{"timestamp":"2024-08-20 15:30:00.837000","data_type":"finding_export","domain_id":"my_domain_id","domain_name":"my_domain_name","user":"my_user"}&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;7&lt;/TD&gt;&lt;TD&gt;{"timestamp":"2024-08-20 15:28:00.837000","data_type":"finding_export","domain_id":"my_domain_id","domain_name":"my_domain_name","path_id":"T0MarkSensitive","path_title":"My Path Title","user":"my_user"}&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;Of the seven (7) events, 1 and 7 differ only in timestamp; 4 and 5 differ only in timestamp; 2 through 6 are missing some fields or another. &amp;nbsp;Is it your attention to deduce them to five (5) events like the following?&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;_raw&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;{"timestamp":"2024-08-20 15:33:00.837000","data_type":"finding_export","domain_id":"my_domain_id","domain_name":"my_domain_name","path_id":"T0MarkSensitive","path_title":"My Path Title","user":"my_user"}&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;2&lt;/TD&gt;&lt;TD&gt;{"timestamp":"2024-08-20 15:32:00.837000","data_type":"finding_export","domain_id":"your_domain_id","domain_name":"your_domain_name","path_id":"T0MarkSensitive","path_title":"My Path Title","user":"my_user"}&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;3&lt;/TD&gt;&lt;TD&gt;{"timestamp":"2024-08-20 15:31:10.837000","data_type":"finding_export","domain_id":"my_domain_id","path_id":"T0MarkSensitive","path_title":"My Path Title","user":"your_user"}&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;4&lt;/TD&gt;&lt;TD&gt;{"timestamp":"2024-08-20 15:31:05.837000","data_type":"finding_export","domain_id":"my_domain_id","path_id":"T0MarkSensitive","path_title":"My Path Title","user":"my_user"}&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;5&lt;/TD&gt;&lt;TD&gt;{"timestamp":"2024-08-20 15:30:00.837000","data_type":"finding_export","domain_id":"my_domain_id","domain_name":"my_domain_name","user":"my_user"}&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;If this is what are you look for, there is no need to perform complicated manipulations and no need for lookup. &amp;nbsp;Just do&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index=my_index data_type=my_sourcetype earliest=-15m latest=now
| fillnull value=UNSPEC
| dedup keepempty=true data_type domain_id domain_name path_id path_title user
``` below simply restores null values, not required for dedup ```
| foreach *
    [eval &amp;lt;&amp;lt;FIELD&amp;gt;&amp;gt; = if(&amp;lt;&amp;lt;FIELD&amp;gt;&amp;gt; == "UNSPEC", null(), &amp;lt;&amp;lt;FIELD&amp;gt;&amp;gt;)]&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is an emulation to produce the sample data illustrated above. &amp;nbsp;You can play with it and compare with real data:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| makeresults format=json data="
        [{\"timestamp\": \"2024-08-20 15:33:00.837000\", \"data_type\": \"finding_export\", \"domain_id\": \"my_domain_id\", \"domain_name\": \"my_domain_name\", \"path_id\": \"T0MarkSensitive\", \"path_title\": \"My Path Title\", \"user\": \"my_user\"},
        {\"timestamp\": \"2024-08-20 15:32:00.837000\", \"data_type\": \"finding_export\", \"domain_id\": \"your_domain_id\", \"domain_name\": \"your_domain_name\", \"path_id\": \"T0MarkSensitive\", \"path_title\": \"My Path Title\", \"user\": \"my_user\"},
        {\"timestamp\": \"2024-08-20 15:31:10.837000\", \"data_type\": \"finding_export\", \"domain_id\": \"my_domain_id\", \"path_id\": \"T0MarkSensitive\", \"path_title\": \"My Path Title\", \"user\": \"your_user\"},
        {\"timestamp\": \"2024-08-20 15:31:05.837000\", \"data_type\": \"finding_export\", \"domain_id\": \"my_domain_id\", \"path_id\": \"T0MarkSensitive\", \"path_title\": \"My Path Title\", \"user\": \"my_user\"},
        {\"timestamp\": \"2024-08-20 15:31:00.837000\", \"data_type\": \"finding_export\", \"domain_id\": \"my_domain_id\", \"path_id\": \"T0MarkSensitive\", \"path_title\": \"My Path Title\", \"user\": \"my_user\"},
        {\"timestamp\": \"2024-08-20 15:30:00.837000\", \"data_type\": \"finding_export\", \"domain_id\": \"my_domain_id\", \"domain_name\": \"my_domain_name\", \"user\": \"my_user\"},
        {\"timestamp\": \"2024-08-20 15:28:00.837000\", \"data_type\": \"finding_export\", \"domain_id\": \"my_domain_id\", \"domain_name\": \"my_domain_name\", \"path_id\": \"T0MarkSensitive\", \"path_title\": \"My Path Title\", \"user\": \"my_user\"}
        ]"
| eval _time = strptime(timestamp, "%F %T.%6N")
``` the above emulates
index=my_index data_type=my_sourcetype earliest=-15m latest=now
```&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 22 Aug 2024 03:54:04 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Handling-nulls-in-a-string/m-p/697024#M236851</guid>
      <dc:creator>yuanliu</dc:creator>
      <dc:date>2024-08-22T03:54:04Z</dc:date>
    </item>
    <item>
      <title>Re: Handling nulls in a string</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Handling-nulls-in-a-string/m-p/697647#M236971</link>
      <description>&lt;P&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/6367"&gt;@bowesmana&lt;/a&gt;, &lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/161352"&gt;@gcusello&lt;/a&gt;, and &lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/33901"&gt;@yuanliu&lt;/a&gt; thanks for the responses.&amp;nbsp; This has been shelved due to funding issues.&amp;nbsp; If it gets funded, we will go back to the vendor and see if they can add something that will say this is new or timestamp it so we can keep track that way.&lt;/P&gt;</description>
      <pubDate>Wed, 28 Aug 2024 19:41:10 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Handling-nulls-in-a-string/m-p/697647#M236971</guid>
      <dc:creator>jwhughes58</dc:creator>
      <dc:date>2024-08-28T19:41:10Z</dc:date>
    </item>
  </channel>
</rss>

