Splunk Search

compare fields by vpn session user and rdp session

nalia_v
Loves-to-Learn Everything

Hello everyone. There is a task of comparing the sessions of the user who came from the VPN and further with the same account in the RDP
if user vpn = user rdp session = "matched", otherwise = "not match"

Session vpn

index=fortigate eventtype=ftnt_fgt_event subtype=vpn (tunneltype="ssl-tunnel" OR tunneltype="ssl-web") 
|transaction startswith=(logdesc="SSL VPN tunnel up") endswith=(command="SSL tunnel established")
|dedup tunnelid

Session rdp

index=windows source = WinEventLog:Microsoft-Windows-TerminalServices* (EventCode=1149 OR EventCode=21)
|mvexpand User
|search User!=NOT_TRANSLATED
|rex field=User "(?<user>[\w+\.\w+]*$)"
|table _time,user,Source_Network_Address

 

I haven't built the query myself yet.

grateful for any thoughts on request

Labels (1)
Tags (1)
0 Karma

richgalloway
SplunkTrust
SplunkTrust

In general, run one query then run other in an append.  Use stats to group the events by the common field(s) (user, in this case).  Compare the fields in the combined events to see which are "matched".

index=fortigate eventtype=ftnt_fgt_event subtype=vpn (tunneltype="ssl-tunnel" OR tunneltype="ssl-web") 
|transaction startswith=(logdesc="SSL VPN tunnel up") endswith=(command="SSL tunnel established")
|dedup tunnelid
```Replace 'something' with the name of the field containing the user's name```
| rename something as user
| append [ search index=windows source = WinEventLog:Microsoft-Windows-TerminalServices* (EventCode=1149 OR EventCode=21)
  |mvexpand User
  |search User!=NOT_TRANSLATED
  |rex field=User "(?<user>[\w+\.\w+]*$)"
  |table _time,user,Source_Network_Address ]
| stats values(*) as * by user
| eval session=if(isnotnull(tunnelid) AND isnotnull(Source_Network_Address),"matched", "not matched")
---
If this reply helps you, Karma would be appreciated.
0 Karma
Get Updates on the Splunk Community!

Get Your Exclusive Splunk Certified Cybersecurity Defense Engineer at Splunk .conf24 ...

We’re excited to announce a new Splunk certification exam being released at .conf24! If you’re headed to Vegas ...

Share Your Ideas & Meet the Lantern team at .Conf! Plus All of This Month’s New ...

Splunk Lantern is Splunk’s customer success center that provides advice from Splunk experts on valuable data ...

Combine Multiline Logs into a Single Event with SOCK: a Step-by-Step Guide for ...

Combine multiline logs into a single event with SOCK - a step-by-step guide for newbies Olga Malita The ...