Dashboards & Visualizations

How to fetch the User from Raw Data

aditsss
Motivator

Hi Team,

I have one Requirement.

I have the below raw Logs that are coming different format . Below are some Examples:

2021-02-12 09:22:32,936 INFO [ Web -4092] AuthenticationFilter Attempting request for (<asriva22><lgposputb500910.ghp.bcp.com><CN=lgposputb50010.ghp.aexp.com, OU=Middleware Utilities, O=ABC  Company, L=Phoenix, ST=Arizona

 

2021-02-12 09:22:38,689 INFO [ Web -4099] o.a.n.w.s.AuthenticationFilter Authentication success for smennen

 

2021-02-12 08:45:05,277 INFO [Web -3253] o.a.n.w.s.AuthenticationFilter Attempting request for (<JWT token>) GET https://ebac/api/flow/controller/bulletins

I want to extract the highlighted field as Request User.

Can someone guide me How can I do that.

Thanks in advance

Labels (3)
0 Karma
1 Solution

ITWhisperer
SplunkTrust
SplunkTrust

Try this

<query>index=abc  sourcetype=xyz  source="user.log" $process_tok1$
| rex field=_raw "(?&lt;id&gt;[A_Za-z0-9]{8}[\-][A_Za-z0-9]{4}[\-][A_Za-z0-9]{4}[\-][A_Za-z0-9]{4}[\-][A_Za-z0-9]{12})"
| rex "Attempting request for \\(\\&lt;(?&lt;user&gt;[^\\&gt;]+)\\&gt;"
| rex "Authentication success for (?&lt;user&gt;\\w+)"
| join type=outer id [inputlookup parent_chains_e1.csv]|search $ckey$|search $Name$|eval ClickHere=url|rex field=url mode=sed "s/\\/\\//\\//g s/https:/https:\\//g"
| table _time _raw host id parent_chain url</query>

View solution in original post

ITWhisperer
SplunkTrust
SplunkTrust

Try these

| rex "Attempting request for \(\<(?<user>[^\>]+)\>"
| rex "Authentication success for (?<user>\w+)"
0 Karma

ITWhisperer
SplunkTrust
SplunkTrust

Try this

<query>index=abc  sourcetype=xyz  source="user.log" $process_tok1$
| rex field=_raw "(?&lt;id&gt;[A_Za-z0-9]{8}[\-][A_Za-z0-9]{4}[\-][A_Za-z0-9]{4}[\-][A_Za-z0-9]{4}[\-][A_Za-z0-9]{12})"
| rex "Attempting request for \\(\\&lt;(?&lt;user&gt;[^\\&gt;]+)\\&gt;"
| rex "Authentication success for (?&lt;user&gt;\\w+)"
| join type=outer id [inputlookup parent_chains_e1.csv]|search $ckey$|search $Name$|eval ClickHere=url|rex field=url mode=sed "s/\\/\\//\\//g s/https:/https:\\//g"
| table _time _raw host id parent_chain url</query>

aditsss
Motivator

@ITWhisperer 

 

I want only one field for the user . How can I achieve this from two rex.

Can you guide me.

0 Karma

ITWhisperer
SplunkTrust
SplunkTrust

The rex use the same field name - for those events that match the first rex will get the field set and those which match the second rex will also get the field. If the event matches neither rex, it won't have the field

0 Karma

aditsss
Motivator

@ITWhisperer 

Below is my current query:

<query>index=abc  sourcetype=xyz  source="user.log" $process_tok1$
| rex field=_raw "(?&lt;id&gt;[A_Za-z0-9]{8}[\-][A_Za-z0-9]{4}[\-][A_Za-z0-9]{4}[\-][A_Za-z0-9]{4}[\-][A_Za-z0-9]{12})"
| join type=outer id [inputlookup parent_chains_e1.csv]|search $ckey$|search $Name$|eval ClickHere=url|rex field=url mode=sed "s/\\/\\//\\//g s/https:/https:\\//g"
| table _time _raw host id parent_chain url</query>

Can you guide me how can I used both rex in this query and fetch user

0 Karma
Get Updates on the Splunk Community!

Splunk Decoded: Service Maps vs Service Analyzer Tree View vs Flow Maps

It’s Monday morning, and your phone is buzzing with alert escalations – your customer-facing portal is running ...

What’s New in Splunk Observability – September 2025

What's NewWe are excited to announce the latest enhancements to Splunk Observability, designed to help ITOps ...

Fun with Regular Expression - multiples of nine

Fun with Regular Expression - multiples of nineThis challenge was first posted on Slack #regex channel ...