<?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: Field extraction and search issue in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Field-extraction-and-search-issue/m-p/528220#M149144</link>
    <description>&lt;P&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/86891"&gt;@mbasharat&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You could change the "UNKNOWN" to "*" in the subsearch, but not sure what that would do for performance with the leading wildcard search.&lt;/P&gt;&lt;P&gt;Alternatively, you can create a new calculated field definition, where you remove the domain from the start of the netbios name and create a new field, say, netbiosHost.&lt;/P&gt;&lt;P&gt;Then in your subsearch, you return the field&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index=source1sample sourcetype="samplesourcetype" [
  | inputlookup sample.csv 
  | table sample_netbios 
  | eval sample_netbios=upper(sample_netbios) 
  | rename sample_netbios as netbiosHost
] &lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;Create your calculated field like is set up using the replace shown in this query&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| makeresults
| eval netbiosName="ABC\HOST"
| eval netbiosHost=replace(netbiosName,"[^\\\]*\\\(.*)","\1")&lt;/LI-CODE&gt;&lt;P&gt;Then you&amp;nbsp; don't need to do the search for all hosts followed by eval as Splunk is doing the calculated field for you.&lt;/P&gt;</description>
    <pubDate>Thu, 05 Nov 2020 21:11:19 GMT</pubDate>
    <dc:creator>bowesmana</dc:creator>
    <dc:date>2020-11-05T21:11:19Z</dc:date>
    <item>
      <title>Field extraction and search issue</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Field-extraction-and-search-issue/m-p/528206#M149133</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I am dealing with an issue because data changed from my source. I was using a lookup as below to search only on the hosts that are in my lookup. This field name NETBIOS was always coming as &lt;STRONG&gt;UNKNOWN\samplehost&lt;/STRONG&gt; so I did a simple eval and added UNKNOWN\ with host name in lookup query and that worked great.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index=source1sample sourcetype="samplesourcetype"

[| inputlookup sample.csv | table sample_netbios | eval sample_netbios=upper(sample_netbios) | rename sample_netbios as netbiosName | eval netbiosName="UNKNOWN"."\\". netbiosName]&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Now, the data has changed in a way that I am seeing domain coming from data source in &lt;STRONG&gt;netbiosName&lt;/STRONG&gt; field e.g.&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;ABC\host1&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;XYZ\host2&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;How can I structure a search where I can filter upfront as in search above regardless of the domain value that come in? I can get rid of the "\" but this means that I will have to eval or rex before everything and then do a match which takes a toll on query performance. My query was taking only about 10 seconds for ~5k hosts matching from lookup to index but aforementioned way cause it to run for ~ 20 mins because it has to go thru all hosts and then do a match on the ones in lookup. Thank in-advance!!!&lt;/P&gt;</description>
      <pubDate>Thu, 05 Nov 2020 20:05:29 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Field-extraction-and-search-issue/m-p/528206#M149133</guid>
      <dc:creator>mbasharat</dc:creator>
      <dc:date>2020-11-05T20:05:29Z</dc:date>
    </item>
    <item>
      <title>Re: Field extraction and search issue</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Field-extraction-and-search-issue/m-p/528220#M149144</link>
      <description>&lt;P&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/86891"&gt;@mbasharat&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You could change the "UNKNOWN" to "*" in the subsearch, but not sure what that would do for performance with the leading wildcard search.&lt;/P&gt;&lt;P&gt;Alternatively, you can create a new calculated field definition, where you remove the domain from the start of the netbios name and create a new field, say, netbiosHost.&lt;/P&gt;&lt;P&gt;Then in your subsearch, you return the field&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index=source1sample sourcetype="samplesourcetype" [
  | inputlookup sample.csv 
  | table sample_netbios 
  | eval sample_netbios=upper(sample_netbios) 
  | rename sample_netbios as netbiosHost
] &lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;Create your calculated field like is set up using the replace shown in this query&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| makeresults
| eval netbiosName="ABC\HOST"
| eval netbiosHost=replace(netbiosName,"[^\\\]*\\\(.*)","\1")&lt;/LI-CODE&gt;&lt;P&gt;Then you&amp;nbsp; don't need to do the search for all hosts followed by eval as Splunk is doing the calculated field for you.&lt;/P&gt;</description>
      <pubDate>Thu, 05 Nov 2020 21:11:19 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Field-extraction-and-search-issue/m-p/528220#M149144</guid>
      <dc:creator>bowesmana</dc:creator>
      <dc:date>2020-11-05T21:11:19Z</dc:date>
    </item>
    <item>
      <title>Re: Field extraction and search issue</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Field-extraction-and-search-issue/m-p/528330#M149174</link>
      <description>&lt;P&gt;Hi bowesmana,&lt;/P&gt;&lt;P&gt;How to consolidate an additional field for &lt;STRONG&gt;netbiosDomain&lt;/STRONG&gt; in your below &lt;STRONG&gt;eval&lt;/STRONG&gt; please?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| makeresults
| eval netbiosName="ABC\HOST"
| eval netbiosHost=replace(netbiosName,"[^\\\]*\\\(.*)","\1")
| eval netbiosDomain=???&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;I have also tried below and this one works as well. However, which one will be a better approach?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| eval Split=split(netbiosName,"\\")
| eval SplitHost=mvindex(Split,1)
| eval SplitDomain=mvindex(Split,0) &lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;By using * in place of UNKNOWN as you suggest produces below error:&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Regex: UTF-8 error: isolated byte with 0x80 bit set.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;Can you provide a RegEx option to extract both Domain and Host that I can add in props.conf and have the fields extracted at the backend so I can do my searches and calculations as normal?&lt;/P&gt;</description>
      <pubDate>Fri, 06 Nov 2020 13:57:17 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Field-extraction-and-search-issue/m-p/528330#M149174</guid>
      <dc:creator>mbasharat</dc:creator>
      <dc:date>2020-11-06T13:57:17Z</dc:date>
    </item>
    <item>
      <title>Re: Field extraction and search issue</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Field-extraction-and-search-issue/m-p/528456#M149228</link>
      <description>&lt;P&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/86891"&gt;@mbasharat&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You will need to set up a new field transformation with&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;(?&amp;lt;netbiosDomain&amp;gt;[^\\]+)\\(?&amp;lt;netbiosHost&amp;gt;.*)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;and your source key as&amp;nbsp;netbiosName. Then create your field extraction to use this transformation. The should give you both fields&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 08 Nov 2020 22:57:36 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Field-extraction-and-search-issue/m-p/528456#M149228</guid>
      <dc:creator>bowesmana</dc:creator>
      <dc:date>2020-11-08T22:57:36Z</dc:date>
    </item>
    <item>
      <title>Re: Field extraction and search issue</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Field-extraction-and-search-issue/m-p/528845#M149323</link>
      <description>&lt;P&gt;Hi&amp;nbsp;@ bowesmana,&lt;/P&gt;&lt;P&gt;Below worked,&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| makeresults
| eval netbiosName="ABC\HOST"
| rex fieldName=netbiosName "(?&amp;lt;NETBIOS_Domain&amp;gt;\w+)\\\(?&amp;lt;NETBIOS_Host&amp;gt;\w+)"&lt;/LI-CODE&gt;&lt;P&gt;I ended up using below evals in props,&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| makeresults
| eval netbiosName="ABC\HOST"
| eval splitHost=mvindex(split(netbiosName,"\\"),1)
| eval splitDomain=mvindex(split(netbiosName,"\\"),0)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 10 Nov 2020 16:08:58 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Field-extraction-and-search-issue/m-p/528845#M149323</guid>
      <dc:creator>mbasharat</dc:creator>
      <dc:date>2020-11-10T16:08:58Z</dc:date>
    </item>
  </channel>
</rss>

