Splunk Search

How to sorted stacked bar chart ?

hjwang
Contributor

dear all

i wanna show ratio in bar chart by special field, for example
i use

my search | stats count by DEST_IP | sort - count | head 10

but i want to show country count in each DEST_IP stats, then i use

my search | chart count over DEST_IP by SRC_IP_countryname

but this will list all DEST_IP with different country count, and can not be sorted by each DEST_IP total count, is there anyway to do this? thanks in advance.

0 Karma

hjwang
Contributor

for example:

if i directly use stats count by DEST_IP | sort - count | head 10, it will be as follows

1.1.1.1 ||||||||||||||||||||

2.2.2.2 ||||||||||||||||||

3.3.3.3 ||||||||||||

4.4.4.4 |||||||||

now, if i use char count over DEST_IP by SRC_IP_countryname, it will be as follows

2.2.2.2 ||||####@@@@^^^^^

1.1.1.1 @@@^^^^^||||||||########

3.3.3.3 |||$$$%%%&&

4.4.4.4 !!!$$$@

here different symbols means different country and its length indicates its ratio in total count
but now it can not be sorted by total count as case 1. how can i do that? thanks

0 Karma

Ant1D
Motivator

Hi,

You can do a search where you count by more than one field. So for example you could do a search like:

my search | stats count by DEST_IP SRC_IP_countryname | fields DEST_IP SRC_IP_countryname count | sort - count

Alternatively, you might want to join two fields together like shown in this example:
`my search | eval twofields=DEST_IP."-".SRC_IP_countryname | stats count by twofields | sort - count

0 Karma

Ant1D
Motivator

sounds like you want to do the following search:
my search | chart sum(SRC_IP_country) by DEST_IP

0 Karma

hjwang
Contributor

not that, clearly to say, i hope sort by total count of DEST_IP firstly, then chart it into stacked bar chart where each bar stand for one DEST_IP, and in each bar it can be seen different SRC_IP_country count

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!

Take Action Automatically on Splunk Alerts with Red Hat Ansible Automation Platform

 Are you ready to revolutionize your IT operations? As digital transformation accelerates, the demand for ...

Calling All Security Pros: Ready to Race Through Boston?

Hey Splunkers, .conf25 is heading to Boston and we’re kicking things off with something bold, competitive, and ...

Beyond Detection: How Splunk and Cisco Integrated Security Platforms Transform ...

Financial services organizations face an impossible equation: maintain 99.9% uptime for mission-critical ...