<?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 Enrichment with sub-search in a certain time period by using index in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Enrichment-with-sub-search-in-a-certain-time-period-by-using/m-p/559656#M158992</link>
    <description>&lt;P&gt;Hi Folks,&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;I am trying to enrich my search with subsearch in the same time bucket/bin. The search can be found below.&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Details:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;U&gt;Main search:&lt;/U&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;looking for 5 times or more failed login attempts from an account/user. if login attempt get failed, userid doesn't show up, however if it can be successful on subsequent attempts, userid shows up in the logs.&lt;BR /&gt;&lt;U&gt;Subsearch :&lt;/U&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;looking for username by using userid. this username will enrich main search's username field along with the userid.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Two complications:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;1. userid is supposed to be unique, but not always, so both main search and subsearch should look for same time frame to create correct results.&amp;nbsp;&lt;/P&gt;&lt;P&gt;2. sometimes subsearch could not find username due to the lack of successful login, in this case I want my main main search should show result without username or fill username with NULL or so.&lt;/P&gt;&lt;P&gt;Note: not sure the following way is proper or not. but looks working without meeting second complication mentioned above.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks,&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;PRE&gt;index="useractivity" event=login response.login=failed
| eval temp=split(userid, ":")
| eval urole=mvindex(temp,5)
| bucket _time span=15m

| join type=inner userid
    [ search index="useractivity" 
    |  eval userid_tmp=split(userid, ":") 
    |  eval userid=mvindex(userid_tmp, 0), username=mvindex(userid_tmp, 1) 
    |  bucket _time span=15m
    |  stats latest(userid) as userid by username ]


| stats values(src_ip)  values(event) count(event) as total by _time user urole userid username 
| where total &amp;gt;= 5&lt;/PRE&gt;</description>
    <pubDate>Thu, 15 Jul 2021 17:04:51 GMT</pubDate>
    <dc:creator>splunkerer</dc:creator>
    <dc:date>2021-07-15T17:04:51Z</dc:date>
    <item>
      <title>Enrichment with sub-search in a certain time period by using index</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Enrichment-with-sub-search-in-a-certain-time-period-by-using/m-p/559656#M158992</link>
      <description>&lt;P&gt;Hi Folks,&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;I am trying to enrich my search with subsearch in the same time bucket/bin. The search can be found below.&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Details:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;U&gt;Main search:&lt;/U&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;looking for 5 times or more failed login attempts from an account/user. if login attempt get failed, userid doesn't show up, however if it can be successful on subsequent attempts, userid shows up in the logs.&lt;BR /&gt;&lt;U&gt;Subsearch :&lt;/U&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;looking for username by using userid. this username will enrich main search's username field along with the userid.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Two complications:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;1. userid is supposed to be unique, but not always, so both main search and subsearch should look for same time frame to create correct results.&amp;nbsp;&lt;/P&gt;&lt;P&gt;2. sometimes subsearch could not find username due to the lack of successful login, in this case I want my main main search should show result without username or fill username with NULL or so.&lt;/P&gt;&lt;P&gt;Note: not sure the following way is proper or not. but looks working without meeting second complication mentioned above.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks,&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;PRE&gt;index="useractivity" event=login response.login=failed
| eval temp=split(userid, ":")
| eval urole=mvindex(temp,5)
| bucket _time span=15m

| join type=inner userid
    [ search index="useractivity" 
    |  eval userid_tmp=split(userid, ":") 
    |  eval userid=mvindex(userid_tmp, 0), username=mvindex(userid_tmp, 1) 
    |  bucket _time span=15m
    |  stats latest(userid) as userid by username ]


| stats values(src_ip)  values(event) count(event) as total by _time user urole userid username 
| where total &amp;gt;= 5&lt;/PRE&gt;</description>
      <pubDate>Thu, 15 Jul 2021 17:04:51 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Enrichment-with-sub-search-in-a-certain-time-period-by-using/m-p/559656#M158992</guid>
      <dc:creator>splunkerer</dc:creator>
      <dc:date>2021-07-15T17:04:51Z</dc:date>
    </item>
    <item>
      <title>Re: Enrichment with sub-search in a certain time period by using index</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Enrichment-with-sub-search-in-a-certain-time-period-by-using/m-p/559894#M159097</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/234050"&gt;@splunkerer&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;With your permission I'll start from the beginning, with your problem statement. You wrote that "&lt;SPAN&gt;if login attempt get failed, userid doesn't show up" and "userid is supposed to be unique, but not always".&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;So how do you link between the failed login events and the following successful&amp;nbsp;one ? by host name or some id ?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;If possible can you share some sample dataset from your dev/QA environment&amp;nbsp;or something similar ?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 17 Jul 2021 09:51:07 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Enrichment-with-sub-search-in-a-certain-time-period-by-using/m-p/559894#M159097</guid>
      <dc:creator>efika</dc:creator>
      <dc:date>2021-07-17T09:51:07Z</dc:date>
    </item>
  </channel>
</rss>

