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!

Extending Observability Content to Splunk Cloud

Watch Now!   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to leverage ...

More Control Over Your Monitoring Costs with Archived Metrics!

What if there was a way you could keep all the metrics data you need while saving on storage costs?This is now ...

New in Observability Cloud - Explicit Bucket Histograms

Splunk introduces native support for histograms as a metric data type within Observability Cloud with Explicit ...