Splunk Search

How can I compare values from a lookup and alert when there is no mach?

yossefn
Path Finder

Hi, 

I have a lookup tables with user names (ftp_users.csv).

Every day I'm getting one line from a particular system with users with FTP permissions, I want to compare between the lookup file (which contains the allowed FTP users) with the line I'm getting from the system and to alert when there is no match. 

The line form the system looks similar to the below row:

users=user1, user2, user3, user4, user5

I'll appreciate any help with that,

Thank you. 

Labels (1)
0 Karma
1 Solution

to4kawa
Ultra Champion

| where isnull(ALLOWED_USERS)

or 

| search ALLOWED_USERS!=*

View solution in original post

to4kawa
Ultra Champion
index=_internal | head 1 | fields _raw _time | eval _raw="users=user1, user2, user3, user4, user5"
| rex "=(?<users>.*)"
| eval users=trim(split(users,","))
| mvexpand users

and

lookup

0 Karma

yossefn
Path Finder

That's great @to4kawa , now I have two fields ("users" field from the system's output, and "user" from my ftp_allowed lookup).

I ran the below stats and got two lists of users, now I just need to compare and alert when there is an extra user under one of the lists. 

 

| stats values(users) as ftp_users, values(user) as allowed_user

 

0 Karma

yossefn
Path Finder

Trying my luck another time..

I have created the below search:

 

 

<my search here>
| fields users
| eval users=trim(split(users,",")) 
| mvexpand users
| lookup as400_ftp_users.csv user as users OUTPUT user
| rename users as FTP_USERS, user as ALLOWED_USERS
| table FTP_USERS ALLOWED_USERS

 

 

Now I have two lists of users, ordered by user name:

MO***FRMO***FR
NA***ZANA***ZA
O***ASO***AS
R***NIR***NI
R***TL 
R***MKAR***MKA
S**IMS**IM
S***ARAS***ARA

 

I want to print out the extra user on the left side (R***TL) because this user is not in the "allowed users" list. 

Is that possible?

Thank you!

Tags (2)
0 Karma

to4kawa
Ultra Champion

| where isnull(ALLOWED_USERS)

or 

| search ALLOWED_USERS!=*

yossefn
Path Finder

Perfect.

Thank you @to4kawa 

0 Karma
Get Updates on the Splunk Community!

Enterprise Security Content Update (ESCU) | New Releases

In December, the Splunk Threat Research Team had 1 release of new security content via the Enterprise Security ...

Why am I not seeing the finding in Splunk Enterprise Security Analyst Queue?

(This is the first of a series of 2 blogs). Splunk Enterprise Security is a fantastic tool that offers robust ...

Index This | What are the 12 Days of Splunk-mas?

December 2024 Edition Hayyy Splunk Education Enthusiasts and the Eternally Curious!  We’re back with another ...