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 + 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 ...

Splunk Observability for AI

Don’t miss out on an exciting Tech Talk on Splunk Observability for AI!Discover how Splunk’s agentic AI ...

🔐 Trust at Every Hop: How mTLS in Splunk Enterprise 10.0 Makes Security Simpler

From Idea to Implementation: Why Splunk Built mTLS into Splunk Enterprise 10.0  mTLS wasn’t just a checkbox ...