Splunk Enterprise Security

How to join information into one table?

syazwani
Path Finder

Hi peeps,

I want to join below information result in one table:

1st query
index=sslvpn
| iplocation src_ip
| search Country != Malaysia
| eval Country = if(isnull(Country),"unknown",Country)
| table _time, user,src_ip,Country,action
| rename user as "User ID", src_ip as "Source IP", action as "Status"

2nd query
index=sslvpn group_path="ADL"
| iplocation accessIP
| where Country !="Malaysia"
| table _time, user,accessIP,Country,action

i try to join this table as below query:

index=sslvpn
| iplocation src_ip
| search Country != Malaysia
| eval Country = if(isnull(Country),"unknown",Country)
| table _time, user,src_ip,Country,action
| append
     [search index=sslvpn group_path="ADL"
     | iplocation accessIP
     | where Country !="Malaysia"
     | rename accessIP as src_ip]
| rename user as "User ID", src_ip as "Source IP" action as "Status"

but the result is not consist of 2nd query information. please help. thankyou.

Labels (1)
0 Karma

richgalloway
SplunkTrust
SplunkTrust

The append command gives you two separate sets of results and it's up to the author to put them together.  That's usually done with the stats command.

index=sslvpn
| iplocation src_ip
| search Country != Malaysia
| eval Country = if(isnull(Country),"unknown",Country)
| table _time, user,src_ip,Country,action
| append
     [search index=sslvpn group_path="ADL"
     | iplocation accessIP
     | where Country !="Malaysia"
     | rename accessIP as src_ip]
| stats values(*) as * by src_ip
| rename user as "User ID", src_ip as "Source IP" action as "Status"

If you want to do the same with using join:

index=sslvpn
| iplocation src_ip
| search Country != Malaysia
| eval Country = if(isnull(Country),"unknown",Country)
| table _time, user,src_ip,Country,action
| join src_ip
     [search index=sslvpn group_path="ADL"
     | iplocation accessIP
     | where Country !="Malaysia"
     | rename accessIP as src_ip]
| rename user as "User ID", src_ip as "Source IP" action as "Status"
---
If this reply helps you, Karma would be appreciated.
Get Updates on the Splunk Community!

Introducing the 2024 SplunkTrust!

Hello, Splunk Community! We are beyond thrilled to announce our newest group of SplunkTrust members!  The ...

Introducing the 2024 Splunk MVPs!

We are excited to announce the 2024 cohort of the Splunk MVP program. Splunk MVPs are passionate members of ...

Splunk Custom Visualizations App End of Life

The Splunk Custom Visualizations apps End of Life for SimpleXML will reach end of support on Dec 21, 2024, ...