Splunk Search

How do I edit my search to add a second field (value) to my chart?

raindrop18
Communicator

I have this string and want to add second value " accountNumber" to the chart. How I can do that?

Current string:

| rex "(?i) IP (?P[^ ]+)" 
| rex "(?i) username (?P[^ ]+)"
| chart dc(UsrName) over clientIp  
|sort - dc(UsrName)

I want add "account number" on the chart. I tried this, but didn't work.

| rex "(?i) IP (?P[^ ]+)"
| rex "(?i) username (?P<UsrName>[^ ]+)" 
| chart dc(UsrName) over clientIp, accountNumber  
| sort - dc(UsrName)

So, what I am trying to have a chart with accountNumber and client IP username.

thanks

Tags (2)
0 Karma

somesoni2
Revered Legend

Try something like this

| rex "(?i) IP (?P[^ ]+)"
 | rex "(?i) username (?P<UsrName>[^ ]+)"  | eval clientIp=clientIp+"-"+accountNumber
 | chart dc(UsrName) over clientIp
 | sort - dc(UsrName)

OR

| rex "(?i) IP (?P[^ ]+)"
 | rex "(?i) username (?P<UsrName>[^ ]+)" 
 | stats dc(UsrName) over clientIp, accountNumber  
 | sort - dc(UsrName)
0 Karma
Get Updates on the Splunk Community!

Splunk Security Content for Threat Detection & Response, Q1 Roundup

Join Principal Threat Researcher, Michael Haag, as he walks through:An introduction to the Splunk Threat ...

Splunk Life | Happy Pride Month!

Happy Pride Month, Splunk Community! &#x1f308; In the United States, as well as many countries around the ...

SplunkTrust | Where Are They Now - Michael Uschmann

The Background Five years ago, Splunk published several videos showcasing members of the SplunkTrust to share ...