Splunk Search

How can I divide two variables in the same search?

byessayian
New Member

Here's an example of a string I'm looking for:

15:55:37.732 ( 5436:15032) G-MST: 2000001D "00020000-dff6-5032-e3c7-0010491e0e23" ("10.101.16.126","10.101.16.147"),6(G722),rsn:1,23:55:37.629 (UTC),pl:20,(s:45, r:38, l:2294),(j:0,u:0,o:0) flgs:0x00000000 "sip:255@10.101.16.11:5441",vpn:0

I'm interested in the percentage of packet loss. Packets sent are "s:45" and packets received are "r:38". For this example, I'd like to generate an alert on a packet loss of 10% or more.

Could someone please help me?

0 Karma
1 Solution

Ayn
Legend
... | rex "\(s:(?<packets_sent>\d+), r:(?<packets_received>\d+)" | eval packet_loss=1-(packets_received/packets_sent) | where packet_loss>0.1

View solution in original post

Ayn
Legend
... | rex "\(s:(?<packets_sent>\d+), r:(?<packets_received>\d+)" | eval packet_loss=1-(packets_received/packets_sent) | where packet_loss>0.1

byessayian
New Member

Wow! That's brilliant! I'm new to the Splunk community. You answered promptly and accurately. That did it. Thank you so much!

0 Karma
Get Updates on the Splunk Community!

Introducing the Splunk Community Dashboard Challenge!

Welcome to Splunk Community Dashboard Challenge! This is your chance to showcase your skills in creating ...

Built-in Service Level Objectives Management to Bridge the Gap Between Service & ...

Wednesday, May 29, 2024  |  11AM PST / 2PM ESTRegister now and join us to learn more about how you can ...

Get Your Exclusive Splunk Certified Cybersecurity Defense Engineer Certification at ...

We’re excited to announce a new Splunk certification exam being released at .conf24! If you’re headed to Vegas ...