<?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 an index for two fields with a join in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Search-an-index-for-two-fields-with-a-join/m-p/703485#M238429</link>
    <description>&lt;P&gt;Thanks - this is defnitely helping a lot. I would love to join the tables in the results. And what I also noticed is that the description isn't always exactly&amp;nbsp;"Leaver Request for" that is why I added&amp;nbsp;affect_dest="STL Leaver" which checks just for leaver tickets&lt;/P&gt;&lt;TABLE border="1" width="191.66666666666666%"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD width="16.666666666666668%" height="25px"&gt;identity&lt;/TD&gt;&lt;TD width="16.666666666666668%" height="25px"&gt;email&lt;/TD&gt;&lt;TD width="16.666666666666668%" height="25px"&gt;extensionattribute10&lt;/TD&gt;&lt;TD width="16.666666666666668%" height="25px"&gt;extensionattribute11&lt;/TD&gt;&lt;TD width="16.666666666666668%" height="25px"&gt;first&lt;/TD&gt;&lt;TD width="8.333333333333334%" height="25px"&gt;last&lt;/TD&gt;&lt;TD width="16.666666666666668%"&gt;_time&lt;/TD&gt;&lt;TD width="16.666666666666668%"&gt;affect_dest&lt;/TD&gt;&lt;TD width="16.666666666666668%"&gt;active&lt;/TD&gt;&lt;TD width="16.666666666666668%"&gt;description&lt;/TD&gt;&lt;TD width="16.666666666666668%"&gt;dv_state&lt;/TD&gt;&lt;TD width="16.666666666666668%"&gt;number&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="16.666666666666668%" height="25px"&gt;nsurname&lt;/TD&gt;&lt;TD width="16.666666666666668%" height="25px"&gt;name.surname@domain.com&lt;/TD&gt;&lt;TD width="16.666666666666668%" height="25px"&gt;nsurnameT1@domain.com&lt;/TD&gt;&lt;TD width="16.666666666666668%" height="25px"&gt;name.surname@consultant.com&lt;/TD&gt;&lt;TD width="16.666666666666668%" height="25px"&gt;name&lt;/TD&gt;&lt;TD width="8.333333333333334%" height="25px"&gt;surname&lt;/TD&gt;&lt;TD width="16.666666666666668%"&gt;&lt;SPAN&gt;2024-10-31 09:46:55&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD width="16.666666666666668%"&gt;STL Leaver&lt;/TD&gt;&lt;TD width="16.666666666666668%"&gt;true&lt;/TD&gt;&lt;TD width="16.666666666666668%"&gt;Leaver Request for Name Surname - 31/10/2024&lt;/TD&gt;&lt;TD width="16.666666666666668%"&gt;active&lt;/TD&gt;&lt;TD width="16.666666666666668%"&gt;INC01&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;</description>
    <pubDate>Mon, 04 Nov 2024 13:22:01 GMT</pubDate>
    <dc:creator>JandrevdM</dc:creator>
    <dc:date>2024-11-04T13:22:01Z</dc:date>
    <item>
      <title>Search an index for two fields with a join</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Search-an-index-for-two-fields-with-a-join/m-p/703096#M238346</link>
      <description>&lt;P&gt;Good day,&lt;BR /&gt;&lt;BR /&gt;I am trying to figure out how I can join two searches to see if there is a service now ticket open for someone leaving the company and if that person is still signing into some of our platforms.&lt;BR /&gt;&lt;BR /&gt;This is to get the signin details into the platform - as users might have multiple email addresses I want them all.&lt;/P&gt;&lt;P&gt;&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=collect_identities sourcetype=ldap:query [ search index=db_mimecast splunkAccountCode=* mcType=auditLog
  |fields user
  | dedup user
  | eval email=user, extensionAttribute10=user, extensionAttribute11=user
  | fields email extensionAttribute10 extensionAttribute11
  | format "(" "(" "OR" ")" "OR" ")" 
  ]
| dedup email
| eval identity=replace(identity, "Adm0", "")
| eval identity=replace(identity, "Adm", "")
| eval identity=lower(identity)
| table email extensionAttribute10 extensionAttribute11 first last identity
| stats 
     values(email) AS email
     values(extensionAttribute10) AS extensionAttribute10
     values(extensionAttribute11) AS extensionAttribute11
     values(first) AS first
     values(last) AS last
     BY identity&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is to check all leavers in snow&lt;/P&gt;&lt;P&gt;&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=db_service_now sourcetype="snow:incident" affect_dest="STL Leaver" 
| dedup description
| table _time affect_dest active description dv_state number&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Unfortunately the Shub does not add the email in the description and only user names and surnames.&lt;BR /&gt;&lt;BR /&gt;So I would need to search the first querys 'first' 'last' against the second query to find leavers.&lt;BR /&gt;&lt;BR /&gt;this is what I tried but it does not work.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&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=collect_identities sourcetype=ldap:query 
[ search index=db_mimecast splunkAccountCode=* mcType=auditLog
  | fields user
  | dedup user
  | eval email=user, extensionAttribute10=user, extensionAttribute11=user
  | fields email extensionAttribute10 extensionAttribute11
  | format "(" "(" "OR" ")" "OR" ")" 
]
| dedup email
| eval identity=replace(identity, "Adm0", "")
| eval identity=replace(identity, "Adm", "")
| eval identity=lower(identity)
| table email extensionAttribute10 extensionAttribute11 first last identity
| search "*first*" "*last*" [ search index=db_service_now sourcetype="snow:incident" affect_dest="STL Leaver" 
  | dedup description
  | table _time affect_dest active description dv_state number
]
| stats values(email) AS email values(extensionAttribute10) AS extensionAttribute10 values(extensionAttribute11) AS extensionAttribute11 values(first) AS first values(last) AS last BY identity&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 30 Oct 2024 11:32:53 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Search-an-index-for-two-fields-with-a-join/m-p/703096#M238346</guid>
      <dc:creator>JandrevdM</dc:creator>
      <dc:date>2024-10-30T11:32:53Z</dc:date>
    </item>
    <item>
      <title>Re: Search an index for two fields with a join</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Search-an-index-for-two-fields-with-a-join/m-p/703111#M238355</link>
      <description>&lt;P&gt;It is not always easy to decipher what your search is trying to do without some sample representative anonymised events and expected results to see what your searches are doing. Please can you provide some events, preferably using the code block &amp;lt;/&amp;gt; button to insert them into your reply.&lt;/P&gt;</description>
      <pubDate>Wed, 30 Oct 2024 13:48:48 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Search-an-index-for-two-fields-with-a-join/m-p/703111#M238355</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2024-10-30T13:48:48Z</dc:date>
    </item>
    <item>
      <title>Re: Search an index for two fields with a join</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Search-an-index-for-two-fields-with-a-join/m-p/703255#M238369</link>
      <description>&lt;P&gt;Sorry for the confusion. So search one gets the result like this.&lt;/P&gt;&lt;TABLE border="1" width="100%"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD width="16.666666666666668%" height="25px"&gt;identity&lt;/TD&gt;&lt;TD width="16.666666666666668%" height="25px"&gt;email&lt;/TD&gt;&lt;TD width="16.666666666666668%" height="25px"&gt;extensionattribute10&lt;/TD&gt;&lt;TD width="16.666666666666668%" height="25px"&gt;extensionattribute11&lt;/TD&gt;&lt;TD width="16.666666666666668%" height="25px"&gt;first&lt;/TD&gt;&lt;TD width="16.666666666666668%" height="25px"&gt;last&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="16.666666666666668%" height="25px"&gt;nsurname&lt;/TD&gt;&lt;TD width="16.666666666666668%" height="25px"&gt;name.surname@domain.com&lt;/TD&gt;&lt;TD width="16.666666666666668%" height="25px"&gt;nsurnameT1@domain.com&lt;/TD&gt;&lt;TD width="16.666666666666668%" height="25px"&gt;name.surname@consultant.com&lt;/TD&gt;&lt;TD width="16.666666666666668%" height="25px"&gt;name&lt;/TD&gt;&lt;TD width="16.666666666666668%" height="25px"&gt;surname&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;BR /&gt;Search two will get all my tickets that was created for people leaving my company and will return results like this&lt;/P&gt;&lt;TABLE border="1" width="100.00000000000001%"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD width="16.666666666666668%"&gt;_time&lt;/TD&gt;&lt;TD width="16.666666666666668%"&gt;affect_dest&lt;/TD&gt;&lt;TD width="16.666666666666668%"&gt;active&lt;/TD&gt;&lt;TD width="16.666666666666668%"&gt;description&lt;/TD&gt;&lt;TD width="16.666666666666668%"&gt;dv_state&lt;/TD&gt;&lt;TD width="16.666666666666668%"&gt;number&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="16.666666666666668%"&gt;&lt;SPAN&gt;2024-10-31 09:46:55&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD width="16.666666666666668%"&gt;STL Leaver&lt;/TD&gt;&lt;TD width="16.666666666666668%"&gt;true&lt;/TD&gt;&lt;TD width="16.666666666666668%"&gt;Leaver Request for Name Surname - 31/10/2024&lt;/TD&gt;&lt;TD width="16.666666666666668%"&gt;active&lt;/TD&gt;&lt;TD width="16.666666666666668%"&gt;INC01&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;So the only way of searching would by to search the second query's description field where first and last appear&lt;/P&gt;</description>
      <pubDate>Thu, 31 Oct 2024 11:20:39 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Search-an-index-for-two-fields-with-a-join/m-p/703255#M238369</guid>
      <dc:creator>JandrevdM</dc:creator>
      <dc:date>2024-10-31T11:20:39Z</dc:date>
    </item>
    <item>
      <title>Re: Search an index for two fields with a join</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Search-an-index-for-two-fields-with-a-join/m-p/703424#M238416</link>
      <description>&lt;P&gt;You didn't illustrate what is the expected results look like. &amp;nbsp;Based on the last stats in your OP, you only want to filter for first, last of people with a leave ticket, not to add any information about the ticket. &amp;nbsp;Is this correct?&lt;/P&gt;&lt;P&gt;In that case, just extract first and last in the second search and use it as subsearch, like this.&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index=collect_identities sourcetype=ldap:query [ search index=db_mimecast splunkAccountCode=* mcType=auditLog
  |fields user
  | dedup user
  | eval email=user, extensionAttribute10=user, extensionAttribute11=user
  | fields email extensionAttribute10 extensionAttribute11
  | format "(" "(" "OR" ")" "OR" ")" 
  ]
    [search index=db_service_now sourcetype="snow:incident" affect_dest="STL Leaver"
    | dedup description
    | rex field=description "Leaver Request for (?&amp;lt;first&amp;gt;\S+) (?&amp;lt;last&amp;gt;\S+) -"
    | fields first last]
| dedup email
| eval identity=replace(identity, "Adm0", "")
| eval identity=replace(identity, "Adm", "")
| eval identity=lower(identity)
| stats 
     values(email) AS email
     values(extensionAttribute10) AS extensionAttribute10
     values(extensionAttribute11) AS extensionAttribute11
     values(first) AS first
     values(last) AS last
     BY identity&lt;/LI-CODE&gt;&lt;P&gt;Note the extraction of first and last depends on the precise format in description; additionally, it assumes that first and last contains no white space.&lt;/P&gt;</description>
      <pubDate>Sun, 03 Nov 2024 05:52:39 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Search-an-index-for-two-fields-with-a-join/m-p/703424#M238416</guid>
      <dc:creator>yuanliu</dc:creator>
      <dc:date>2024-11-03T05:52:39Z</dc:date>
    </item>
    <item>
      <title>Re: Search an index for two fields with a join</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Search-an-index-for-two-fields-with-a-join/m-p/703485#M238429</link>
      <description>&lt;P&gt;Thanks - this is defnitely helping a lot. I would love to join the tables in the results. And what I also noticed is that the description isn't always exactly&amp;nbsp;"Leaver Request for" that is why I added&amp;nbsp;affect_dest="STL Leaver" which checks just for leaver tickets&lt;/P&gt;&lt;TABLE border="1" width="191.66666666666666%"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD width="16.666666666666668%" height="25px"&gt;identity&lt;/TD&gt;&lt;TD width="16.666666666666668%" height="25px"&gt;email&lt;/TD&gt;&lt;TD width="16.666666666666668%" height="25px"&gt;extensionattribute10&lt;/TD&gt;&lt;TD width="16.666666666666668%" height="25px"&gt;extensionattribute11&lt;/TD&gt;&lt;TD width="16.666666666666668%" height="25px"&gt;first&lt;/TD&gt;&lt;TD width="8.333333333333334%" height="25px"&gt;last&lt;/TD&gt;&lt;TD width="16.666666666666668%"&gt;_time&lt;/TD&gt;&lt;TD width="16.666666666666668%"&gt;affect_dest&lt;/TD&gt;&lt;TD width="16.666666666666668%"&gt;active&lt;/TD&gt;&lt;TD width="16.666666666666668%"&gt;description&lt;/TD&gt;&lt;TD width="16.666666666666668%"&gt;dv_state&lt;/TD&gt;&lt;TD width="16.666666666666668%"&gt;number&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="16.666666666666668%" height="25px"&gt;nsurname&lt;/TD&gt;&lt;TD width="16.666666666666668%" height="25px"&gt;name.surname@domain.com&lt;/TD&gt;&lt;TD width="16.666666666666668%" height="25px"&gt;nsurnameT1@domain.com&lt;/TD&gt;&lt;TD width="16.666666666666668%" height="25px"&gt;name.surname@consultant.com&lt;/TD&gt;&lt;TD width="16.666666666666668%" height="25px"&gt;name&lt;/TD&gt;&lt;TD width="8.333333333333334%" height="25px"&gt;surname&lt;/TD&gt;&lt;TD width="16.666666666666668%"&gt;&lt;SPAN&gt;2024-10-31 09:46:55&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD width="16.666666666666668%"&gt;STL Leaver&lt;/TD&gt;&lt;TD width="16.666666666666668%"&gt;true&lt;/TD&gt;&lt;TD width="16.666666666666668%"&gt;Leaver Request for Name Surname - 31/10/2024&lt;/TD&gt;&lt;TD width="16.666666666666668%"&gt;active&lt;/TD&gt;&lt;TD width="16.666666666666668%"&gt;INC01&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;</description>
      <pubDate>Mon, 04 Nov 2024 13:22:01 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Search-an-index-for-two-fields-with-a-join/m-p/703485#M238429</guid>
      <dc:creator>JandrevdM</dc:creator>
      <dc:date>2024-11-04T13:22:01Z</dc:date>
    </item>
  </channel>
</rss>

