<?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: Search and display results of a single field among two sourcetypes in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Search-and-display-results-of-a-single-field-among-two/m-p/509873#M142535</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/213957"&gt;@richgalloway&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for the reply, when trying this, it gives me an error which says "Unbalanced Quotes" I am unsure why because the quotes seem correct.&lt;/P&gt;&lt;P&gt;Here is the code:&amp;nbsp;&lt;/P&gt;&lt;P&gt;EDIT: Added the keyword "search" after the "["&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index="foo" host="bar" sourcetype="user_activity" [search index="foo" host="bar" sourcetype="signons" System_Account="*on behalf of*"
| rex "Session_ID\": "(?&amp;lt;session_id&amp;gt;\w+)"
| fields session_id
| format ]&lt;/LI-CODE&gt;</description>
    <pubDate>Sat, 18 Jul 2020 22:03:53 GMT</pubDate>
    <dc:creator>aaroncherian</dc:creator>
    <dc:date>2020-07-18T22:03:53Z</dc:date>
    <item>
      <title>Search and display results of a single field among two sourcetypes</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Search-and-display-results-of-a-single-field-among-two/m-p/509866#M142532</link>
      <description>&lt;P&gt;Hello,&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a sourcetype called "signons" and it has a field called "Session_ID" and "System_Account"&lt;/P&gt;&lt;P&gt;In my search, I am looking for any proxy sessions and want to display those proxy sessions with the same "Session_ID" in the sourcetype called "user_activity".&lt;/P&gt;&lt;P&gt;To check if a session is a proxy session, the "System_Account" field has the words "on behalf of".&lt;/P&gt;&lt;P&gt;Here is my search so far:&amp;nbsp;&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;index="foo" host="bar" sourcetype="signons" System_Account="*on behalf of*"&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;One example of an event that returns:&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; "System_Account": "12345 / Aaron Cherian on behalf of 67890 / John Doe",
 "Authentication_Type": "Proxy Started",
 "Session_ID": "4743ha",
 "Is_Admin": "1",
 "Elapsed_Time_Minutes": "1029"&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I want to take this Session_ID (There are multiple different Session_ID's because there are many proxy sessions that are being run during the day) and search for the events in a different sourcetype called "user_activity" (This basically checks the user activity for that specific Session_ID.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is my search for that:&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;index="foo" host="bar" sourcetype="user_activity" 4743ha&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is just displaying the events for that specific Session_ID. Is there a way to search for all Session_ID's that have the words "on behalf of" in the "System_Account" field in the "user_activity" sourcetype and display the events? Basically I want to combine these two searches for all proxy Session_ID's&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;&lt;P&gt;EDIT: I have posted the same post accidentally under a different category. I am unsure to how to delete it. I apologize for the double post.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 18 Jul 2020 20:52:20 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Search-and-display-results-of-a-single-field-among-two/m-p/509866#M142532</guid>
      <dc:creator>aaroncherian</dc:creator>
      <dc:date>2020-07-18T20:52:20Z</dc:date>
    </item>
    <item>
      <title>Re: Search and display results of a single field among two sourcetypes</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Search-and-display-results-of-a-single-field-among-two/m-p/509872#M142534</link>
      <description>&lt;P&gt;You can combine the two searches using the subsearch approach.&amp;nbsp; Subsearches execute first, so use the subsearch to find the session_id then they'll be passed to the other search to be located in user_activity.&amp;nbsp; This assumes the user_activity sourcetype has a field called &lt;FONT face="courier new,courier"&gt;session_id&lt;/FONT&gt;.&amp;nbsp; If the field has a different name then the subsearch will need modification (change 'session_id' to something else).&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index="foo" host="bar" sourcetype="user_activity" [ index="foo" host="bar" sourcetype="signons" System_Account="*on behalf of*"
| rex "Session_ID\": "(?&amp;lt;session_id&amp;gt;\w+)"
| fields session_id
| format ]&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 18 Jul 2020 21:51:03 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Search-and-display-results-of-a-single-field-among-two/m-p/509872#M142534</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2020-07-18T21:51:03Z</dc:date>
    </item>
    <item>
      <title>Re: Search and display results of a single field among two sourcetypes</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Search-and-display-results-of-a-single-field-among-two/m-p/509873#M142535</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/213957"&gt;@richgalloway&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for the reply, when trying this, it gives me an error which says "Unbalanced Quotes" I am unsure why because the quotes seem correct.&lt;/P&gt;&lt;P&gt;Here is the code:&amp;nbsp;&lt;/P&gt;&lt;P&gt;EDIT: Added the keyword "search" after the "["&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index="foo" host="bar" sourcetype="user_activity" [search index="foo" host="bar" sourcetype="signons" System_Account="*on behalf of*"
| rex "Session_ID\": "(?&amp;lt;session_id&amp;gt;\w+)"
| fields session_id
| format ]&lt;/LI-CODE&gt;</description>
      <pubDate>Sat, 18 Jul 2020 22:03:53 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Search-and-display-results-of-a-single-field-among-two/m-p/509873#M142535</guid>
      <dc:creator>aaroncherian</dc:creator>
      <dc:date>2020-07-18T22:03:53Z</dc:date>
    </item>
    <item>
      <title>Re: Search and display results of a single field among two sourcetypes</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Search-and-display-results-of-a-single-field-among-two/m-p/509875#M142537</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index="foo" host="bar" sourcetype="user_activity" [search index="foo" host="bar" sourcetype="signons" System_Account="*on behalf of*"
| rex "Session_ID\": \"(?&amp;lt;session_id&amp;gt;\w+)\""
| fields session_id
| format ]&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;well, your log is JSON? your query has unescaped quotes.&lt;BR /&gt;&lt;BR /&gt;please provide sample logs. we can make the appropriate query.&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;index="foo" host="bar" sourcetype="user_activity" OR  sourcetype="signons" 
| rex "Session_ID\": \"(?&amp;lt;session_id&amp;gt;\w+)\""
| stats values(System_Account) as System_Account values(Authentication_Type) as Authentication_Type values(Is_Admin) as Is_Admin values(Elapsed_Time_Minutes) as Elapsed_Time_Minutes count(eval(like(System_Account,"%on behalf of%"))) as SA_count by session_id
| where SA_count &amp;gt; 0
| table System_Account Authentication_Type session_id Is_Admin Elapsed_Time_Minutes&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;this works ,I guess.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 19 Jul 2020 02:08:49 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Search-and-display-results-of-a-single-field-among-two/m-p/509875#M142537</guid>
      <dc:creator>to4kawa</dc:creator>
      <dc:date>2020-07-19T02:08:49Z</dc:date>
    </item>
    <item>
      <title>Re: Search and display results of a single field among two sourcetypes</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Search-and-display-results-of-a-single-field-among-two/m-p/509877#M142538</link>
      <description>&lt;P&gt;Worked like a charm! Exactly what I needed. Thank you sir.&lt;/P&gt;</description>
      <pubDate>Sun, 19 Jul 2020 04:48:57 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Search-and-display-results-of-a-single-field-among-two/m-p/509877#M142538</guid>
      <dc:creator>aaroncherian</dc:creator>
      <dc:date>2020-07-19T04:48:57Z</dc:date>
    </item>
  </channel>
</rss>

