Security

Get the list of Users from the below message in a Log file

webnair
Explorer

In the below log file: the users are JACK, ROGER

I used something like this: source="/var/log/splunk/splunkcloud/" message=*User

I need to just get the User from the below message string.

{[-]
app : "test_res",
level : 1,
message : "User JACK logged into Serv from IP address: x.xx.xxx.xx",
time : "2014-04-16T17:28:26+00:00"
}
Show as raw text
date_hour=17 Options| date_mday=16 Options| date_minute=23 Options| date_month=april Options| date_second=2 Options| date_wday=wednesday Options| date_year=2014 Options| date_zone=local Options| host=splunk Options| index=main Options| linecount=1 Options| punct={"":"","":"____:...","":,"":"--::+:"} Options| source=/var/log/splunk/splunkcloud.log Options| sourcetype=access_combined Options| splunk_server=splunk Options
2 » 4/16/14
5:23:02.000 PM

{[-]
app : "test_res",
level : 1,
message : "User ROGER logged into ownCloud from IP address: xx.xx.xxx.xx",
time : "2014-04-16T17:28:25+00:00"
}
Show as raw text
date_hour=17 Options| date_mday=16 Options| date_minute=23 Options| date_month=april Options| date_second=2 Options| date_wday=wednesday Options| date_year=2014 Options| date_zone=local Options| host=splunk Options| index=main Options| linecount=1 Options| punct={"":"","":"
____:...","":,"":"--::+:"} Options| source=/var/log/splunk/splunkcloud.log Options| sourcetype=access_combined Options| splunk_server=ala-splunk

Tags (3)
0 Karma

lguinn2
Legend

This should work

source="/var/log/splunk/splunkcloud/" message=User*
| rex "message.*?User\s(?<User>\S+)"

This should give you the a field named User.

0 Karma

martin_mueller
SplunkTrust
SplunkTrust

You could for example append a call to top:

source="/var/log/splunk/splunkcloud/" message=User* | rex "message.*?User\s(?<User>\S+)" | top User
0 Karma

webnair
Explorer

Thanks lguinn for the quick response. However, I do not get the list of Users. I'm looking to get just the User (JACK, ROGER) from the above log to be displayed.
The source is ="/var/log/splunk/splunkcloud/*"It will be very valuable if you can let me know how to get just the username from the message string from the above log

0 Karma
Get Updates on the Splunk Community!

Threat Hunting Unlocked: How to Uplevel Your Threat Hunting With the PEAK Framework ...

WATCH NOWAs AI starts tackling low level alerts, it's more critical than ever to uplevel your threat hunting ...

Splunk APM: New Product Features + Community Office Hours Recap!

Howdy Splunk Community! Over the past few months, we’ve had a lot going on in the world of Splunk Application ...

Index This | Forward, I’m heavy; backward, I’m not. What am I?

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