Splunk Search

How to extract one value from log in a query

mbojorq3
New Member

I am trying to extract the name of log output but struggling with how to. I have this query

<query>index=dap ("user login Time") </query>

That I have a log that outputs

log: [2m2021-11-19-t18:27:42.996z [22m [34m auth [39m [32minfo user login time, Justin [ ...

stream: stdout

time:  2021-11-19-t18:2742.99648142z

 

I want to output only the time and username:

Time:                                         user:

2021-11-19-t18:27:42.     Time, Justin

Labels (2)
Tags (1)
0 Karma

ITWhisperer
SplunkTrust
SplunkTrust

Assuming time has already been extracted (_time) on indexing, you could try this to get the user

| rex "user login\s+(?<user>[^\[]+)\s\["
0 Karma
Get Updates on the Splunk Community!

Automatic Discovery Part 1: What is Automatic Discovery in Splunk Observability Cloud ...

If you’ve ever deployed a new database cluster, spun up a caching layer, or added a load balancer, you know it ...

Real-Time Fraud Detection: How Splunk Dashboards Protect Financial Institutions

Financial fraud isn't slowing down. If anything, it's getting more sophisticated. Account takeovers, credit ...

Splunk + ThousandEyes: Correlate frontend, app, and network data to troubleshoot ...

 Are you tired of troubleshooting delays caused by siloed frontend, application, and network data? We've got a ...