Splunk Search

How to edit my search to find the channel connection count?

abhijit_mishra9
New Member

Hi All,

I have CSV file read by Splunk. Here is how the data look like. The field extraction is done.

APP  CHANNEL   IP
app1    chl1      1.1.1.1
app2    chl1      1.1.1.1
app3    chl1      1.1.1.2
app4    chl2      1.1.1.3
app5    chl2      1.1.1.3
app6    chl2      1.1.1.3

I wanted to extract what CHANNEL is connected from which IP and count for each IP connected.
Basically something like below

CHANNEL IP       Count
chl1       1.1.1.1  2
           1.1.1.2  1
chl2       1.1.1.3  3

I tried this, index=mycsv_index | stats count values(CHANNEL) as CHL_COUNT by IP. But it does not seems to give me desired results.
Please help.

Regards,
Abhijit

0 Karma
1 Solution

somesoni2
Revered Legend

Try like this

index=mycsv_index | stats count by IP CHANNEL | stats list(IP) as IP list(count) as Count by CHANNEL

View solution in original post

0 Karma

somesoni2
Revered Legend

Try like this

index=mycsv_index | stats count by IP CHANNEL | stats list(IP) as IP list(count) as Count by CHANNEL
0 Karma

somesoni2
Revered Legend

Try this

index=mycsv_index | stats count by IP CHANNEL | stats list(IP) as IP list(count) as Count sum(count) as TotalConn by CHANNEL
0 Karma

abhijit_mishra9
New Member

You are awesome..Thanks

0 Karma

abhijit_mishra9
New Member

Thanks @somesoni2. Worked perfectly for me. Appreciate your help.

Can I also get a total IPs count added to the same output. If this works out I can use that column (say - TotalChannelConn) to send alert when a channel total connection reaches a certain threshold.
Something like this.

+---------+---------+-------+-------------+
| CHANNEL | IP | COUNT | TOTAL_COUNT |
+---------+---------+-------+-------------+
| chl1 | 1.1.1.1 | 2 | 3 |
+---------+---------+-------+-------------+
| | 1.1.1.2 | 1 | |
+---------+---------+-------+-------------+
| chl2 | 1.1.1.3 | 3 | 3 |
+---------+---------+-------+-------------+

0 Karma
Get Updates on the Splunk Community!

Webinar Recap | Revolutionizing IT Operations: The Transformative Power of AI and ML ...

The Transformative Power of AI and ML in Enhancing Observability   In the realm of IT operations, the ...

.conf24 | Registration Open!

Hello, hello! I come bearing good news: Registration for .conf24 is now open!   conf is Splunk’s rad annual ...

ICYMI - Check out the latest releases of Splunk Edge Processor

Splunk is pleased to announce the latest enhancements to Splunk Edge Processor.  HEC Receiver authorization ...