<?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: How to join 2 splunk searches to filter data in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-join-2-splunk-searches-to-filter-data/m-p/655857#M226523</link>
    <description>&lt;P&gt;i have tried with appendcols command but not getting column from sub search&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;index=_internal sourcetype=splunkd source="/opt/splunk/var/log/splunk/metrics.log" group=tcpin_connections os=Windows&lt;BR /&gt;| dedup hostname&lt;BR /&gt;| eval age=(now()-_time)&lt;BR /&gt;| eval LastActiveTime=strftime(_time,"%y/%m/%d %H:%M:%S")&lt;BR /&gt;| eval Status=if(age&amp;lt; 3600,"Running","DOWN")&lt;BR /&gt;| rename age AS Age&lt;BR /&gt;| eval Age=tostring(Age,"duration")&lt;BR /&gt;| lookup 0010_Solarwinds_Nodes_Export&lt;BR /&gt;Caption as hostname&lt;BR /&gt;OUTPUT&lt;BR /&gt;Application_Primary_Support_Group AS CMDB2_Application_Primary_Support_Group,&lt;BR /&gt;Application_Primary AS CMDB2_Application_Primary,&lt;BR /&gt;Support_Group AS CMDB2_Support_Group&lt;BR /&gt;NodeID AS SW2_NodeID&lt;BR /&gt;Enriched_SW AS Enriched_SW2&lt;BR /&gt;Environment AS CMDB2_Environment&lt;BR /&gt;| eval Assign_To_Support_Group=if(Assign_To_Support_Group_Tag="CMDB_Support_Group", CMDB2_Support_Group, CMDB2_Application_Primary_Support_Group)&lt;BR /&gt;| table _time, hostname,Status, sourceIp, LastActiveTime, Age, SW2_NodeID, Assign_To_Support_Group, CMDB2_Support_Group, CMDB2_Environment&lt;BR /&gt;| appendcols&lt;BR /&gt;[search index=ivz_em_solarwinds source=solwarwinds_query://Solarwinds_PROD_unmanaged_Nodes_Data&lt;BR /&gt;| table Node Account Status From Until&lt;BR /&gt;| dedup Node]&lt;/P&gt;</description>
    <pubDate>Mon, 28 Aug 2023 14:47:32 GMT</pubDate>
    <dc:creator>sekhar463</dc:creator>
    <dc:date>2023-08-28T14:47:32Z</dc:date>
    <item>
      <title>How to join 2 splunk searches to filter data</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-join-2-splunk-searches-to-filter-data/m-p/655807#M226505</link>
      <description>&lt;P&gt;Hi Team,&lt;/P&gt;&lt;P&gt;I have 2 splunk searches in which i want to exclude of hostname in first search matches with Node field in the 2nd search.&lt;/P&gt;&lt;P&gt;how can i modify for joining this 2 searches to exclude hostname.&lt;/P&gt;&lt;P&gt;common field is hostname field in first one and it will be as Node field in the 2nd search&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;index=_internal sourcetype=splunkd source="/opt/splunk/var/log/splunk/metrics.log" group=tcpin_connections os=Windows&lt;BR /&gt;| dedup hostname&lt;BR /&gt;| eval age=(now()-_time)&lt;BR /&gt;| eval LastActiveTime=strftime(_time,"%y/%m/%d %H:%M:%S")&lt;BR /&gt;| eval Status=if(age&amp;lt; 3600,"Running","DOWN")&lt;BR /&gt;| rename age AS Age&lt;BR /&gt;| eval Age=tostring(Age,"duration")&lt;BR /&gt;| lookup 0010_Solarwinds_Nodes_Export&lt;BR /&gt;Caption as hostname&lt;BR /&gt;OUTPUT&lt;BR /&gt;Application_Primary_Support_Group AS CMDB2_Application_Primary_Support_Group,&lt;BR /&gt;Application_Primary AS CMDB2_Application_Primary,&lt;BR /&gt;Support_Group AS CMDB2_Support_Group&lt;BR /&gt;NodeID AS SW2_NodeID&lt;BR /&gt;Enriched_SW AS Enriched_SW2&lt;BR /&gt;Environment AS CMDB2_Environment&lt;BR /&gt;| eval Assign_To_Support_Group=if(Assign_To_Support_Group_Tag="CMDB_Support_Group", CMDB2_Support_Group, CMDB2_Application_Primary_Support_Group)&lt;BR /&gt;| table _time, hostname,sourceIp, Status, LastActiveTime, Age, SW2_NodeID,Assign_To_Support_Group, CMDB2_Support_Group,CMDB2_Environment&lt;BR /&gt;|where Status="DOWN" AND NOT isnull(SW2_NodeID) AND CMDB2_Environment="Production"&lt;BR /&gt;| sort 0 hostname&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;index=ivz_em_solarwinds source="solwarwinds_query://Test_unmanaged_Nodes_Data"&lt;BR /&gt;| table Node Account Status From Until&lt;BR /&gt;| dedup Node&lt;/P&gt;</description>
      <pubDate>Mon, 28 Aug 2023 10:33:16 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-join-2-splunk-searches-to-filter-data/m-p/655807#M226505</guid>
      <dc:creator>sekhar463</dc:creator>
      <dc:date>2023-08-28T10:33:16Z</dc:date>
    </item>
    <item>
      <title>Re: How to join 2 splunk searches to filter data</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-join-2-splunk-searches-to-filter-data/m-p/655810#M226507</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/244375"&gt;@sekhar463&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;I suppose that "Node" from the second search is the hostname of the first and that you want to use the Node from the second as kay to filter the first search.&lt;/P&gt;&lt;P&gt;If this is true, you can use the second search as a subsearch of the first, renaming the field, something like this:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index=_internal sourcetype=splunkd source="/opt/splunk/var/log/splunk/metrics.log" group=tcpin_connections os=Windows [ search index=ivz_em_solarwinds source="solwarwinds_query://Test_unmanaged_Nodes_Data" | table Node Account Status From Until | dedup Node | rename Node AS hostnae | fields hostname ]
| dedup hostname
| eval age=(now()-_time)
| eval LastActiveTime=strftime(_time,"%y/%m/%d %H:%M:%S")
| eval Status=if(age&amp;lt; 3600,"Running","DOWN")
| rename age AS Age
| eval Age=tostring(Age,"duration")
| lookup 0010_Solarwinds_Nodes_Export Caption as hostname OUTPUT Application_Primary_Support_Group AS CMDB2_Application_Primary_Support_Group,
Application_Primary AS CMDB2_Application_Primary, Support_Group AS CMDB2_Support_Group NodeID AS SW2_NodeID Enriched_SW AS Enriched_SW2
Environment AS CMDB2_Environment 
| eval Assign_To_Support_Group=if(Assign_To_Support_Group_Tag="CMDB_Support_Group", CMDB2_Support_Group, CMDB2_Application_Primary_Support_Group)
| table _time, hostname,sourceIp, Status, LastActiveTime, Age, SW2_NodeID,Assign_To_Support_Group, CMDB2_Support_Group,CMDB2_Environment
| where Status="DOWN" AND NOT isnull(SW2_NodeID) AND CMDB2_Environment="Production"
| sort 0 hostname&lt;/LI-CODE&gt;&lt;P&gt;This solution has only one limitation: the subsearch can have max 50,000 results.&lt;/P&gt;&lt;P&gt;Ciao.&lt;/P&gt;&lt;P&gt;Giuseppe&lt;/P&gt;</description>
      <pubDate>Mon, 28 Aug 2023 10:41:19 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-join-2-splunk-searches-to-filter-data/m-p/655810#M226507</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2023-08-28T10:41:19Z</dc:date>
    </item>
    <item>
      <title>Re: How to join 2 splunk searches to filter data</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-join-2-splunk-searches-to-filter-data/m-p/655834#M226514</link>
      <description>&lt;P&gt;Not showing any results.&lt;/P&gt;&lt;P&gt;actually i want to add status column based on the 2nd search results in the first.&lt;/P&gt;&lt;P&gt;if any hostname is matches with node name in the 2nd comun then it show the respective status or not there it show as null for status&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 28 Aug 2023 12:24:59 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-join-2-splunk-searches-to-filter-data/m-p/655834#M226514</guid>
      <dc:creator>sekhar463</dc:creator>
      <dc:date>2023-08-28T12:24:59Z</dc:date>
    </item>
    <item>
      <title>Re: How to join 2 splunk searches to filter data</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-join-2-splunk-searches-to-filter-data/m-p/655846#M226517</link>
      <description>&lt;P&gt;not getting status field from 2nd search&amp;nbsp;&lt;BR /&gt;Not showing any results.&lt;/P&gt;&lt;P&gt;actually i want to add status column based on the 2nd search results in the first.&lt;/P&gt;&lt;P&gt;if any hostname is matches with node name in the 2nd comun then it show the respective status or not there it show as null for status&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 28 Aug 2023 13:51:24 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-join-2-splunk-searches-to-filter-data/m-p/655846#M226517</guid>
      <dc:creator>sekhar463</dc:creator>
      <dc:date>2023-08-28T13:51:24Z</dc:date>
    </item>
    <item>
      <title>Re: How to join 2 splunk searches to filter data</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-join-2-splunk-searches-to-filter-data/m-p/655857#M226523</link>
      <description>&lt;P&gt;i have tried with appendcols command but not getting column from sub search&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;index=_internal sourcetype=splunkd source="/opt/splunk/var/log/splunk/metrics.log" group=tcpin_connections os=Windows&lt;BR /&gt;| dedup hostname&lt;BR /&gt;| eval age=(now()-_time)&lt;BR /&gt;| eval LastActiveTime=strftime(_time,"%y/%m/%d %H:%M:%S")&lt;BR /&gt;| eval Status=if(age&amp;lt; 3600,"Running","DOWN")&lt;BR /&gt;| rename age AS Age&lt;BR /&gt;| eval Age=tostring(Age,"duration")&lt;BR /&gt;| lookup 0010_Solarwinds_Nodes_Export&lt;BR /&gt;Caption as hostname&lt;BR /&gt;OUTPUT&lt;BR /&gt;Application_Primary_Support_Group AS CMDB2_Application_Primary_Support_Group,&lt;BR /&gt;Application_Primary AS CMDB2_Application_Primary,&lt;BR /&gt;Support_Group AS CMDB2_Support_Group&lt;BR /&gt;NodeID AS SW2_NodeID&lt;BR /&gt;Enriched_SW AS Enriched_SW2&lt;BR /&gt;Environment AS CMDB2_Environment&lt;BR /&gt;| eval Assign_To_Support_Group=if(Assign_To_Support_Group_Tag="CMDB_Support_Group", CMDB2_Support_Group, CMDB2_Application_Primary_Support_Group)&lt;BR /&gt;| table _time, hostname,Status, sourceIp, LastActiveTime, Age, SW2_NodeID, Assign_To_Support_Group, CMDB2_Support_Group, CMDB2_Environment&lt;BR /&gt;| appendcols&lt;BR /&gt;[search index=ivz_em_solarwinds source=solwarwinds_query://Solarwinds_PROD_unmanaged_Nodes_Data&lt;BR /&gt;| table Node Account Status From Until&lt;BR /&gt;| dedup Node]&lt;/P&gt;</description>
      <pubDate>Mon, 28 Aug 2023 14:47:32 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-join-2-splunk-searches-to-filter-data/m-p/655857#M226523</guid>
      <dc:creator>sekhar463</dc:creator>
      <dc:date>2023-08-28T14:47:32Z</dc:date>
    </item>
    <item>
      <title>Re: How to join 2 splunk searches to filter data</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-join-2-splunk-searches-to-filter-data/m-p/655866#M226524</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/244375"&gt;@sekhar463&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;let me understand: you have to perform a join to extract the status field from the second search using as keys Node=hostname, is it correct?&lt;/P&gt;&lt;P&gt;If this is your requirement, appendcols isn't the solution, you could use "join" but I don't like it because there's the limit of 50,000 results in the second search and because it's very slow.&lt;/P&gt;&lt;P&gt;You should correlate events using stats, something like this:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;(index=_internal sourcetype=splunkd source="/opt/splunk/var/log/splunk/metrics.log" group=tcpin_connections os=Windows) OR (index=ivz_em_solarwinds source="solwarwinds_query://Test_unmanaged_Nodes_Data")
| rename hostname=coalesce(hostname,Node)
| stats latest(_time) AS _time values(status) AS status BY hostname
| eval age=(now()-_time)
| eval LastActiveTime=strftime(_time,"%y/%m/%d %H:%M:%S")
| eval Status=if(age&amp;lt; 3600,"Running","DOWN")
| rename age AS Age
| eval Age=tostring(Age,"duration")
| lookup 0010_Solarwinds_Nodes_Export Caption as hostname OUTPUT Application_Primary_Support_Group AS CMDB2_Application_Primary_Support_Group,
Application_Primary AS CMDB2_Application_Primary, Support_Group AS CMDB2_Support_Group NodeID AS SW2_NodeID Enriched_SW AS Enriched_SW2
Environment AS CMDB2_Environment 
| eval Assign_To_Support_Group=if(Assign_To_Support_Group_Tag="CMDB_Support_Group", CMDB2_Support_Group, CMDB2_Application_Primary_Support_Group)
| table _time, hostname,sourceIp, Status, LastActiveTime, Age, SW2_NodeID,Assign_To_Support_Group, CMDB2_Support_Group,CMDB2_Environment
| where Status="DOWN" AND NOT isnull(SW2_NodeID) AND CMDB2_Environment="Production"
| sort 0 hostname&lt;/LI-CODE&gt;&lt;P&gt;please see the approach, if some field is missing, add it to the stats command.&lt;/P&gt;&lt;P&gt;ciao.&lt;/P&gt;&lt;P&gt;Giuseppe&lt;/P&gt;</description>
      <pubDate>Mon, 28 Aug 2023 15:39:48 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-join-2-splunk-searches-to-filter-data/m-p/655866#M226524</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2023-08-28T15:39:48Z</dc:date>
    </item>
    <item>
      <title>Re: How to join 2 splunk searches to filter data</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-join-2-splunk-searches-to-filter-data/m-p/661363#M228337</link>
      <description>&lt;P&gt;This is not working, the second search has one field&amp;nbsp;StatusDescription, i want to add this using common field Name and host in 1st search&lt;BR /&gt;&lt;BR /&gt;1st search:&lt;BR /&gt;&lt;BR /&gt;```Table on Dashboard = M3_PROD_splunk__agent__universal_forwarder_status_is_down```&lt;BR /&gt;index=_internal sourcetype=splunkd source="/opt/splunk/var/log/splunk/metrics.log" group=tcpin_connections os=Windows&lt;BR /&gt;| dedup hostname&lt;BR /&gt;| eval age=(now()-_time)&lt;BR /&gt;| eval LastActiveTime=strftime(_time,"%y/%m/%d %H:%M:%S")&lt;BR /&gt;| eval Status=if(age&amp;lt; 3600,"Running","DOWN")&lt;BR /&gt;| rename age AS Age&lt;BR /&gt;| eval Age=tostring(Age,"duration")&lt;BR /&gt;| lookup 0010_Solarwinds_Nodes_Export&lt;BR /&gt;Caption as hostname&lt;BR /&gt;OUTPUT&lt;BR /&gt;Application_Primary_Support_Group AS CMDB2_Application_Primary_Support_Group,&lt;BR /&gt;Application_Primary AS CMDB2_Application_Primary,&lt;BR /&gt;Support_Group AS CMDB2_Support_Group&lt;BR /&gt;NodeID AS SW2_NodeID&lt;BR /&gt;Enriched_SW AS Enriched_SW2&lt;BR /&gt;Environment AS CMDB2_Environment&lt;BR /&gt;| eval Assign_To_Support_Group=if(Assign_To_Support_Group_Tag="CMDB_Support_Group", CMDB2_Support_Group, CMDB2_Application_Primary_Support_Group)&lt;BR /&gt;| where Status="DOWN" AND NOT isnull(SW2_NodeID) AND (CMDB2_Environment="Production" OR CMDB2_Environment="PRODUCTION")&lt;BR /&gt;```| table _time, hostname,sourceIp, Status, LastActiveTime, Age, SW2_NodeID,Assign_To_Support_Group, CMDB2_Support_Group,CMDB2_Environment```&lt;BR /&gt;| table _time, hostname,sourceIp, Status, LastActiveTime, Age, Assign_To_Support_Group, CMDB2_Environment&lt;BR /&gt;&lt;BR /&gt;2nd search :&lt;BR /&gt;&lt;BR /&gt;index=index_name sourcetype="nodes"&lt;BR /&gt;| lookup lookupfile1 Name OUTPUTNEW&lt;BR /&gt;| dedup Caption&lt;BR /&gt;| table Caption StatusDescription UnManaged UnManageFrom UnManageUntil&lt;BR /&gt;| search UnManaged=true&lt;BR /&gt;| eval UnManageUntil = strftime(strptime(UnManageUntil, "%Y-%m-%dT%H:%M:%S.%QZ"), "%Y-%m-%d %H:%M:%S")&lt;BR /&gt;| eval UnManageFrom = strftime(strptime(UnManageFrom, "%Y-%m-%dT%H:%M:%S.%QZ"), "%Y-%m-%d %H:%M:%S")&lt;BR /&gt;| eval UnManageUntil = coalesce(UnManageUntil, "NOT SET") ```replaces any null values in the "UnManageUntil" field with NOT SET```&lt;BR /&gt;| sort -UnManageFrom ```sorts the events in descending order based on the "UnManageFrom" field```&lt;/P&gt;</description>
      <pubDate>Thu, 19 Oct 2023 12:37:10 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-join-2-splunk-searches-to-filter-data/m-p/661363#M228337</guid>
      <dc:creator>sekhar463</dc:creator>
      <dc:date>2023-10-19T12:37:10Z</dc:date>
    </item>
  </channel>
</rss>

