From 3e6a0510fdd91dcbb44d763d4e9df0a99253f1b8 Mon Sep 17 00:00:00 2001 From: Alejandro Antonio Moreno Sancho Date: Sat, 7 May 2022 12:05:42 +0200 Subject: [PATCH] Added TimeFlowStartMs and TimeFlowEndMs to Netflow v5 --- producer/producer_nflegacy.go | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/producer/producer_nflegacy.go b/producer/producer_nflegacy.go index 9c7e1dc..30d7659 100644 --- a/producer/producer_nflegacy.go +++ b/producer/producer_nflegacy.go @@ -14,10 +14,12 @@ func ConvertNetFlowLegacyRecord(baseTime uint32, uptime uint32, record netflowle flowMessage.Type = flowmessage.FlowMessage_NETFLOW_V5 - timeDiffFirst := (uptime - record.First) / 1000 - timeDiffLast := (uptime - record.Last) / 1000 - flowMessage.TimeFlowStart = uint64(baseTime - timeDiffFirst) - flowMessage.TimeFlowEnd = uint64(baseTime - timeDiffLast) + timeDiffFirst := (uptime - record.First) + timeDiffLast := (uptime - record.Last) + flowMessage.TimeFlowStart = uint64(baseTime - timeDiffFirst / 1000) + flowMessage.TimeFlowStartMs = uint64(baseTime)*1000 - uint64(timeDiffFirst) + flowMessage.TimeFlowEnd = uint64(baseTime - timeDiffLast / 1000) + flowMessage.TimeFlowEndMs = uint64(baseTime)*1000 - uint64(timeDiffLast) v := make(net.IP, 4) binary.BigEndian.PutUint32(v, record.NextHop)