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
Career Survey
First 500 qualified respondents will receive a $20 gift card! Tell us about your professional Splunk journey.

Can’t make it to .conf25? Join us online!

Get Updates on the Splunk Community!

Community Content Calendar, September edition

Welcome to another insightful post from our Community Content Calendar! We're thrilled to continue bringing ...

Splunkbase Unveils New App Listing Management Public Preview

Splunkbase Unveils New App Listing Management Public PreviewWe're thrilled to announce the public preview of ...

Leveraging Automated Threat Analysis Across the Splunk Ecosystem

Are you leveraging automation to its fullest potential in your threat detection strategy?Our upcoming Security ...