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!

Strengthen Your Future: A Look Back at Splunk 10 Innovations and .conf25 Highlights!

The Big One: Splunk 10 is Here!  The moment many of you have been waiting for has arrived! We are thrilled to ...

Now Offering the AI Assistant Usage Dashboard in Cloud Monitoring Console

Today, we’re excited to announce the release of a brand new AI assistant usage dashboard in Cloud Monitoring ...

Stay Connected: Your Guide to October Tech Talks, Office Hours, and Webinars!

What are Community Office Hours? Community Office Hours is an interactive 60-minute Zoom series where ...