<?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: SPL query in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-write-this-search-to-find-these-2-fields-with-the/m-p/638563#M221276</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/254020"&gt;@RanjiRaje&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;good for you, see next time!&lt;/P&gt;&lt;P&gt;Ciao and happy splunking&lt;/P&gt;&lt;P&gt;Giuseppe&lt;/P&gt;&lt;P&gt;P.S.: Karma Points are appreciated &lt;span class="lia-unicode-emoji" title=":winking_face:"&gt;😉&lt;/span&gt;&lt;/P&gt;</description>
    <pubDate>Tue, 04 Apr 2023 06:36:02 GMT</pubDate>
    <dc:creator>gcusello</dc:creator>
    <dc:date>2023-04-04T06:36:02Z</dc:date>
    <item>
      <title>How do I write this search to find these 2 fields with the lookup hostname?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-write-this-search-to-find-these-2-fields-with-the/m-p/638421#M221262</link>
      <description>&lt;P&gt;Hi, I need your suggestion here. Please guide me&lt;/P&gt;
&lt;P&gt;I have a lookup file with list of hosts. I need to compare it with splunk data and populate the matching count.&lt;/P&gt;
&lt;P&gt;Query:&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;index=idxname (sourcetype=sourceA desc=windows) OR (sourcetype=sourceB)
| fields device.hostname,event.HostName
| rename device.hostname as hostfield, event.HostName as hostfield
| lookup lookupfilename fieldname as hostfield OUTPUTNEW Platform
| fields hostfield,Platform
| stats dc(hostfield) as "totalcount" by Platform&lt;/LI-CODE&gt;
&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;I have 2 different sourcetype under the same index. &lt;STRONG&gt;sourceA&lt;/STRONG&gt; has a field "&lt;STRONG&gt;device.hostname&lt;/STRONG&gt;" and &lt;STRONG&gt;sourceB&lt;/STRONG&gt; has a fields "&lt;STRONG&gt;event.HostName&lt;/STRONG&gt;".&lt;/P&gt;
&lt;P&gt;[&amp;nbsp; lookup file --&amp;gt;&amp;nbsp;hostfield: AA,BB,CC&lt;/P&gt;
&lt;P&gt;sourceA,device.hostname --&amp;gt; &lt;STRONG&gt;AA&lt;/STRONG&gt;,XX,YY&lt;/P&gt;
&lt;P&gt;sourceB,event.HostName --&amp;gt; &lt;STRONG&gt;CC&lt;/STRONG&gt;,PP,KK&lt;/P&gt;
&lt;P&gt;my output count should be 2&amp;nbsp; &amp;nbsp; ]&lt;/P&gt;
&lt;P&gt;If any of these 2 fields value is matching with the lookup hostname, then it should be considered.&lt;BR /&gt;I tried rename command. Please provide your inputs..&lt;/P&gt;</description>
      <pubDate>Tue, 04 Apr 2023 16:43:15 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-write-this-search-to-find-these-2-fields-with-the/m-p/638421#M221262</guid>
      <dc:creator>RanjiRaje</dc:creator>
      <dc:date>2023-04-04T16:43:15Z</dc:date>
    </item>
    <item>
      <title>Re: SPL query</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-write-this-search-to-find-these-2-fields-with-the/m-p/638422#M221263</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/254020"&gt;@RanjiRaje&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;instead rename, you could use eval coalesce to have one field called hostname:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index=idxname (sourcetype=sourceA desc=windows) OR (sourcetype=sourceB)
| eval hostfield=coalesce(device.hostname,event.HostName)
| lookup lookupfilename fieldname as hostfield OUTPUTNEW Platform
| stats dc(hostfield) AS "totalcount" BY Platform&lt;/LI-CODE&gt;&lt;P&gt;Ciao.&lt;/P&gt;&lt;P&gt;Giuseppe&lt;/P&gt;</description>
      <pubDate>Mon, 03 Apr 2023 16:00:35 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-write-this-search-to-find-these-2-fields-with-the/m-p/638422#M221263</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2023-04-03T16:00:35Z</dc:date>
    </item>
    <item>
      <title>Re: SPL query</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-write-this-search-to-find-these-2-fields-with-the/m-p/638423#M221264</link>
      <description>&lt;P&gt;Hi Sir,&lt;/P&gt;&lt;P&gt;I tried with eval - coalesce command too. But it didnt give the output.&lt;/P&gt;</description>
      <pubDate>Mon, 03 Apr 2023 16:04:42 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-write-this-search-to-find-these-2-fields-with-the/m-p/638423#M221264</guid>
      <dc:creator>RanjiRaje</dc:creator>
      <dc:date>2023-04-03T16:04:42Z</dc:date>
    </item>
    <item>
      <title>Re: SPL query</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-write-this-search-to-find-these-2-fields-with-the/m-p/638424#M221265</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/254020"&gt;@RanjiRaje&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;pease try this:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index=idxname (sourcetype=sourceA desc=windows) OR (sourcetype=sourceB)
| rename device.hostname AS hostname event.HostName AS HostName
| eval hostfield=coalesce(hostname,HostName)
| lookup lookupfilename fieldname as hostfield OUTPUTNEW Platform
| stats dc(hostfield) AS "totalcount" BY Platform&lt;/LI-CODE&gt;&lt;P&gt;Ciao.&lt;/P&gt;&lt;P&gt;Giuseppe&lt;/P&gt;</description>
      <pubDate>Mon, 03 Apr 2023 16:10:42 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-write-this-search-to-find-these-2-fields-with-the/m-p/638424#M221265</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2023-04-03T16:10:42Z</dc:date>
    </item>
    <item>
      <title>Re: SPL query</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-write-this-search-to-find-these-2-fields-with-the/m-p/638426#M221266</link>
      <description>&lt;P&gt;Thanks sir for a quick response. renamed and tried using coalesce. It worked !!!!&lt;/P&gt;</description>
      <pubDate>Mon, 03 Apr 2023 17:03:42 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-write-this-search-to-find-these-2-fields-with-the/m-p/638426#M221266</guid>
      <dc:creator>RanjiRaje</dc:creator>
      <dc:date>2023-04-03T17:03:42Z</dc:date>
    </item>
    <item>
      <title>Re: SPL query</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-write-this-search-to-find-these-2-fields-with-the/m-p/638563#M221276</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/254020"&gt;@RanjiRaje&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;good for you, see next time!&lt;/P&gt;&lt;P&gt;Ciao and happy splunking&lt;/P&gt;&lt;P&gt;Giuseppe&lt;/P&gt;&lt;P&gt;P.S.: Karma Points are appreciated &lt;span class="lia-unicode-emoji" title=":winking_face:"&gt;😉&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 04 Apr 2023 06:36:02 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-write-this-search-to-find-these-2-fields-with-the/m-p/638563#M221276</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2023-04-04T06:36:02Z</dc:date>
    </item>
  </channel>
</rss>

