Perhaps the coffee hasn’t kicked in yet… been trying to get this working and it just isn’t turning out right. Even my Google-fu is off…
Our VPN reports the number of seconds a person was connected and I want to report that in a more readable fashion… so rather than 3,700 seconds I could see 1 hour, 1 minute, 40 seconds … or p1h1m40s … or 01:01:40… I am sure I am once again missing something simple. my un-working rule:
rule "RA-Pulse-3-close"
when
has_field("pulse_appliance") &&
contains(to_string($message.message),"Closed connection to")
then
let pulseLine = grok("%{PULSE_VPN_3_CLOSE}",to_string($message.message), true);
set_fields(pulseLine);
set_field("timestamp_short",format_date(value: to_date($message.timestamp), format: "yyMMdd-EEEE hh:mm aa", timezone: "America/New_York"));
let duration = now() - now() - seconds(to_long($message.pulse_connectsec));
set_field("pulse_Connection_Time", duration);
end
In this iteration it throws the error:
For rule 'RA-Pulse-3-close': At 9:19 an exception was thrown: org.joda.time.Duration cannot be cast to java.lang.Double