<?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: Correlation Help Log in Getting Data In</title>
    <link>https://community.splunk.com/t5/Getting-Data-In/Correlation-Help-Log/m-p/686720#M114491</link>
    <description>&lt;P&gt;&lt;BR /&gt;I tried the command you gave me, but nothing is displayed when adding _time in the BY.&lt;BR /&gt;Additionally, I added other data, but I would like to display one user per line rather than grouping multiple users together because they share the same IP address. For instance, on a certain IP address, multiple services were used, but I don't know which service was used.&lt;BR /&gt;So, if we display one user per line, I think it will be unnecessary to use earliest and latest and just display the correct _time, right?&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;(index="index1" Users =* IP=*) OR (index="index2" tag=1 )
| where NOT match(Users, "^AAA-[0-9]{5}\$")
| eval IP=if(match(IP, "^::ffff:"), replace(IP, "^::ffff:(\d+\.\d+\.\d+\.\d+)$", "\1"), IP)
| eval ip=coalesce(IP,srcip)
| stats
dc(index) AS index_count
values(Users) AS Users
values(destip) AS destip
values(service) AS service
earliest(_time) AS earliest
latest(_time) AS latest
BY ip
| where index_count&amp;gt;1
| eval
earliest=strftime(earliest,"%Y-%m-%d %H:%M:%S"),
latest=strftime(latest,"%Y-%m-%d %H:%M:%S")
| table Users, ip, dest_ip, service, earliest, latest&lt;/LI-CODE&gt;</description>
    <pubDate>Tue, 07 May 2024 14:22:14 GMT</pubDate>
    <dc:creator>m92</dc:creator>
    <dc:date>2024-05-07T14:22:14Z</dc:date>
    <item>
      <title>Correlation Help Log</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Correlation-Help-Log/m-p/686550#M114466</link>
      <description>&lt;P&gt;Hello Splunkers, I'm new to Splunk and I'm stuck; I'm getting more data than I'm supposed to. Users are showing up when they shouldn't, and vice versa.&lt;BR /&gt;The purpose of the query is to determine which users are accessing the bastion with the tag=1 from the "index2" index. However, there's no information on&lt;BR /&gt;the users. That's why I'm fetching user data from the "index1" index by performing a join on the IP address.&lt;BR /&gt;The ultimate goal is to display the results in the following format: Users - IP - _time. It's important to note that IP addresses are dynamic.&lt;/P&gt;
&lt;P&gt;When I run this command, it returns 1000 lines: `index="index2" tag=1 | table srcip, _time`&lt;/P&gt;
&lt;P&gt;However, when I run this command, I get a lot more (11000), even though I'm supposed to have the same number since I'm just fetching users from the other&lt;BR /&gt;index, but I'm not supposed to have any additional lines:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;index="index1" | search Users =* AND IP=*
| fields Users, IP, _time
| where NOT match(Users, "^AAA-[0-9]{5}\$")
| eval IP=if(match(IP, "^::ffff:"), replace(IP, "^::ffff:(\d+\.\d+\.\d+\.\d+)$", "\1"), IP)
| eval ip=IP
| table Users, ip, _time
| join type=inner ip
[ search index="index2" tag=1 | fields srcip, _time | eval ip=srcip | table ip, _time]
| table Users, ip, _time&lt;/LI-CODE&gt;
&lt;P&gt;&lt;BR /&gt;Does anyone have a solution?&lt;/P&gt;</description>
      <pubDate>Mon, 06 May 2024 10:41:33 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Correlation-Help-Log/m-p/686550#M114466</guid>
      <dc:creator>m92</dc:creator>
      <dc:date>2024-05-06T10:41:33Z</dc:date>
    </item>
    <item>
      <title>Re: Correlation Help Log</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Correlation-Help-Log/m-p/686556#M114467</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/267617"&gt;@m92&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;Spunk isn't a database, so avoid to use the join command because it's a very slow command,&lt;/P&gt;&lt;P&gt;in addition you divided your search in three levels adding more slowness,&lt;/P&gt;&lt;P&gt;so try to correlate events using stats BY the correlation key, something like this (to adapt to your use case):&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;(index="index1" Users =* IP=*) OR (index="index2" tag=1 )
| regex Users!="^AAA-[0-9]{5}\$"
| eval IP=if(match(IP, "^::ffff:"), replace(IP, "^::ffff:(\d+\.\d+\.\d+\.\d+)$", "\1"), IP)
| eval ip=coalesce(IP,srcip)
| stats
     values(Users) AS Users
     earliest(_time) AS earliest
     latest(_time) AS latest
     ip
| eval 
     earliest=strftime(earliest,"%Y-%m-%d %H:%M:%S"),
     latest=strftime(latest,"%Y-%m-%d %H:%M:%S")
| table Users, ip, earliest latest&lt;/LI-CODE&gt;&lt;P&gt;Ciao.&lt;/P&gt;&lt;P&gt;Giuseppe&lt;/P&gt;</description>
      <pubDate>Mon, 06 May 2024 10:45:07 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Correlation-Help-Log/m-p/686556#M114467</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2024-05-06T10:45:07Z</dc:date>
    </item>
    <item>
      <title>Re: Correlation Help Log</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Correlation-Help-Log/m-p/686559#M114468</link>
      <description>&lt;P&gt;I have results, but the problem is that it displays users who don't have an IP address (so it shows users from index1 even if no match was found in index2). What I would like is for it to fetch and display only users if the IP addresses match correctly at the right time. Furthermore, I always have more lines (3000 versus 1000).&lt;/P&gt;</description>
      <pubDate>Mon, 06 May 2024 11:48:20 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Correlation-Help-Log/m-p/686559#M114468</guid>
      <dc:creator>m92</dc:creator>
      <dc:date>2024-05-06T11:48:20Z</dc:date>
    </item>
    <item>
      <title>Re: Correlation Help Log</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Correlation-Help-Log/m-p/686567#M114469</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/267617"&gt;@m92&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;if you want only IPs present in both indexes, you could use this search:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;(index="index1" Users =* IP=*) OR (index="index2" tag=1 )
| regex Users!="^AAA-[0-9]{5}\$"
| eval IP=if(match(IP, "^::ffff:"), replace(IP, "^::ffff:(\d+\.\d+\.\d+\.\d+)$", "\1"), IP)
| eval ip=coalesce(IP,srcip)
| stats
     dc(index) AS index_count
     values(Users) AS Users
     earliest(_time) AS earliest
     latest(_time) AS latest
     BY ip
| where index_count&amp;gt;1
| eval 
     earliest=strftime(earliest,"%Y-%m-%d %H:%M:%S"),
     latest=strftime(latest,"%Y-%m-%d %H:%M:%S")
| table Users, ip, earliest latest&lt;/LI-CODE&gt;&lt;P&gt;Ciao.&lt;/P&gt;&lt;P&gt;Giuseppe&lt;/P&gt;</description>
      <pubDate>Mon, 06 May 2024 12:38:37 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Correlation-Help-Log/m-p/686567#M114469</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2024-05-06T12:38:37Z</dc:date>
    </item>
    <item>
      <title>Re: Correlation Help Log</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Correlation-Help-Log/m-p/686569#M114470</link>
      <description>&lt;P&gt;It only displays users with their IP addresses, but the problem is that I still have a lot more lines than with this command:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;index="index2" tag=1 | table srcip, _time&lt;/LI-CODE&gt;
&lt;P&gt;&lt;BR /&gt;(8000 lines versus 1000)&lt;BR /&gt;So, I think either it's not filtering enough or it's adding users who aren't supposed to be there.&lt;BR /&gt;How can I handle this?&lt;/P&gt;</description>
      <pubDate>Mon, 06 May 2024 14:04:59 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Correlation-Help-Log/m-p/686569#M114470</guid>
      <dc:creator>m92</dc:creator>
      <dc:date>2024-05-06T14:04:59Z</dc:date>
    </item>
    <item>
      <title>Re: Correlation Help Log</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Correlation-Help-Log/m-p/686673#M114482</link>
      <description>&lt;P&gt;&lt;EM&gt;Would anyone know how to do it?&lt;/EM&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 07 May 2024 11:53:22 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Correlation-Help-Log/m-p/686673#M114482</guid>
      <dc:creator>m92</dc:creator>
      <dc:date>2024-05-07T11:53:22Z</dc:date>
    </item>
    <item>
      <title>Re: Correlation Help Log</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Correlation-Help-Log/m-p/686684#M114487</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/267617"&gt;@m92&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;with the table command you have many events with the same srcip and dfferent _time.&lt;/P&gt;&lt;P&gt;Do you want different lines if you have different _time?&lt;/P&gt;&lt;P&gt;if yes, you can add _time to the BY clause&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;(index="index1" Users =* IP=*) OR (index="index2" tag=1 )
| regex Users!="^AAA-[0-9]{5}\$"
| eval IP=if(match(IP, "^::ffff:"), replace(IP, "^::ffff:(\d+\.\d+\.\d+\.\d+)$", "\1"), IP)
| eval ip=coalesce(IP,srcip)
| stats
     dc(index) AS index_count
     values(Users) AS Users
     BY ip _time
| where index_count&amp;gt;1
| table Users, ip, _time&lt;/LI-CODE&gt;&lt;P&gt;even if, in this way you could have different _time in the two indexes so it will be difficoult to group by _time.&lt;/P&gt;&lt;P&gt;Ciao.&lt;/P&gt;&lt;P&gt;Giuseppe&lt;/P&gt;</description>
      <pubDate>Tue, 07 May 2024 12:25:05 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Correlation-Help-Log/m-p/686684#M114487</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2024-05-07T12:25:05Z</dc:date>
    </item>
    <item>
      <title>Re: Correlation Help Log</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Correlation-Help-Log/m-p/686720#M114491</link>
      <description>&lt;P&gt;&lt;BR /&gt;I tried the command you gave me, but nothing is displayed when adding _time in the BY.&lt;BR /&gt;Additionally, I added other data, but I would like to display one user per line rather than grouping multiple users together because they share the same IP address. For instance, on a certain IP address, multiple services were used, but I don't know which service was used.&lt;BR /&gt;So, if we display one user per line, I think it will be unnecessary to use earliest and latest and just display the correct _time, right?&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;(index="index1" Users =* IP=*) OR (index="index2" tag=1 )
| where NOT match(Users, "^AAA-[0-9]{5}\$")
| eval IP=if(match(IP, "^::ffff:"), replace(IP, "^::ffff:(\d+\.\d+\.\d+\.\d+)$", "\1"), IP)
| eval ip=coalesce(IP,srcip)
| stats
dc(index) AS index_count
values(Users) AS Users
values(destip) AS destip
values(service) AS service
earliest(_time) AS earliest
latest(_time) AS latest
BY ip
| where index_count&amp;gt;1
| eval
earliest=strftime(earliest,"%Y-%m-%d %H:%M:%S"),
latest=strftime(latest,"%Y-%m-%d %H:%M:%S")
| table Users, ip, dest_ip, service, earliest, latest&lt;/LI-CODE&gt;</description>
      <pubDate>Tue, 07 May 2024 14:22:14 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Correlation-Help-Log/m-p/686720#M114491</guid>
      <dc:creator>m92</dc:creator>
      <dc:date>2024-05-07T14:22:14Z</dc:date>
    </item>
    <item>
      <title>Re: Correlation Help Log</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Correlation-Help-Log/m-p/686767#M114495</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/267617"&gt;@m92&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;I added eariest and latest because you have _time in your searches, but you can ignore them.&lt;/P&gt;&lt;P&gt;Ciao.&lt;/P&gt;&lt;P&gt;Giuseppe&lt;/P&gt;</description>
      <pubDate>Tue, 07 May 2024 15:20:36 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Correlation-Help-Log/m-p/686767#M114495</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2024-05-07T15:20:36Z</dc:date>
    </item>
  </channel>
</rss>

