Splunk Search

How to add the count of two different fields' values?

i111040d
New Member

For example:

|stats count by src_ip

src_ip count
1.1.1.1 100
2.2.2.2 200
3.3.3.3 300

|stats count by dst_ip

dst_ip count
1.1.1.1 200
2.2.2.2 300
3.3.3.3 400

On these conditions, I wan to create the table

ip_addr count
1.1.1.1 300
2.2.2.2 500
3.3.3.3 700

How can I create the table?

0 Karma
1 Solution

sundareshr
Legend

Assuming both fields exist on each event, try this

.... | eval ip=src_ip.",".dst_ip | makemv ip delim="," | mvexpand ip | stats count by ip

View solution in original post

0 Karma

sundareshr
Legend

Assuming both fields exist on each event, try this

.... | eval ip=src_ip.",".dst_ip | makemv ip delim="," | mvexpand ip | stats count by ip
0 Karma

i111040d
New Member

I could do it!
Thanks a lot bro 🙂

0 Karma
Career Survey
First 500 qualified respondents will receive a $20 gift card! Tell us about your professional Splunk journey.
Get Updates on the Splunk Community!

.conf25 Global Broadcast: Don’t Miss a Moment

Hello Splunkers, .conf25 is only a click away.  Not able to make it to .conf25 in person? No worries, you can ...

Observe and Secure All Apps with Splunk

 Join Us for Our Next Tech Talk: Observe and Secure All Apps with SplunkAs organizations continue to innovate ...

What's New in Splunk Observability - August 2025

What's New We are excited to announce the latest enhancements to Splunk Observability Cloud as well as what is ...