I’m parsing some Cisco UCM call detail records into Graylog using a pipeline rule:
rule "parse ucm cdr log"
when
has_field("ucm_type") && to_string($message.ucm_type) == "cdr"
then
let message_field = to_string($message.message);
let parsed_fields = grok("..<omitted for brevity>..", message_field);
set_fields(parsed_fields);
let epoch = parse_date("1970-01-01T00:00:00.000Z", "yyyy-MM-dd'T'HH:mm:ss.SSSZ", "UTC");
let ts_seconds = seconds(to_long($message.ucm_dateTimeOrigination));
set_field("ucm_dateTimeOrigination", epoch + ts_seconds);
let ts_seconds = seconds(to_long($message.ucm_dateTimeConnect));
set_field("ucm_dateTimeConnect", epoch + ts_seconds);
let ts_seconds = seconds(to_long($message.ucm_dateTimeDisconnect));
set_field("ucm_dateTimeDisconnect", epoch + ts_seconds);
end
3 fields are in epoch time format, so I’m using the method above of adding those seconds to a 1970 date and then setting the fields with the date values. If I view the fields in the Graylog Message pane, they appear to be UTC dates (which is fine). However, if I run Quick Values against any of those fields, they show up in the original seconds/epoch format.
I don’t think that you’re doing anything wrong.
Let Graylog do a statistical chart against the timestamp field of the message itself. It’ll convert the timestamps to epoch seconds. I think this has to do with some internal conversion or fallbacks of the displaying libraries.
But I have some pointers for you:
But I guess you already saw this topic since you are using the seconds() function