Hi!
I had to change the rules and go to “pipeline-only” to be able to convert to “double”:
rule "Fortigate Process CEF for traffic"
when
contains(to_string($message.message), "CEF:0", true)
then
let result = regex(("(CEF:.*)$"),to_string($message.message));
let pure_cef = to_string(result["0"]);
// Remove in and out for later extraction from message field by EXTRACTOR
let pure_cef = regex_replace("(.*)( out=[0-9]{1,20} )(.*)", pure_cef, "$1 $3");
let pure_cef = regex_replace("(.*)( in=[0-9]{1,20} )(.*)", pure_cef, "$1 $3");
set_fields(parse_cef(to_string(pure_cef), false));
set_field("message", to_string(result["0"]));
// set_field("pure_cef", to_string(pure_cef));
end
rule "Fortigate Process Traffic Counters Full Sessions"
when
contains(to_string($message.message), " in=", true)
AND contains(to_string($message.message), " out=", true)
AND NOT contains(to_string($message.message), " FTNTFGTlogid=0000000020 ", true)
then
let intotal = to_double(regex_replace("(.* in=)([0-9]{1,20})( .*)",to_string($message.message),"$2"));
let outtotal = to_double(regex_replace("(.* out=)([0-9]{1,20})( .*)",to_string($message.message),"$2"));
set_field("in", to_double(intotal));
set_field("out", to_double(outtotal));
end
rule "Fortigate Process Traffic Counters Partial Sessions"
when
contains(to_string($message.message), " in=", true)
AND contains(to_string($message.message), " out=", true)
AND contains(to_string($message.message), " FTNTFGTlogid=0000000020 ", true)
then
let intotal = to_double(regex_replace("(.* in=)([0-9]{1,20})( .*)",to_string($message.message),"$2"));
let outtotal = to_double(regex_replace("(.* out=)([0-9]{1,20})( .*)",to_string($message.message),"$2"));
set_field("intotal", to_double(intotal));
set_field("outtotal", to_double(intotal));
let inbyte = to_double(regex_replace("(.* FTNTFGTrcvddelta=)([0-9]{1,20})(.*)",to_string($message.message),"$2"));
let outbyte = to_double(regex_replace("(.* FTNTFGTsentdelta=)([0-9]{1,20})(.*)",to_string($message.message),"$2"));
set_field("in", to_double(inbyte));
set_field("out", to_double(outbyte));
end