Fix event.timestamp pointer usage (#1621)

* Fix event.timestamp pointer usage

* avoid returning an error when creating alerts if something goes wrong during the parsing

Co-authored-by: Sebastien Blot <sebastien@crowdsec.net>
This commit is contained in:
AlteredCoder 2022-06-30 17:35:42 +02:00 committed by GitHub
parent 863facaa33
commit 02e0f3c095
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 11 deletions

View file

@ -188,7 +188,8 @@ func EventsFromQueue(queue *Queue) []*models.Event {
}
//either MarshaledTime is present and is extracted from log
if evt.MarshaledTime != "" {
ovflwEvent.Timestamp = &evt.MarshaledTime
tmpTimeStamp := evt.MarshaledTime
ovflwEvent.Timestamp = &tmpTimeStamp
} else if !evt.Time.IsZero() { //or .Time has been set during parse as time.Now().UTC()
ovflwEvent.Timestamp = new(string)
raw, err := evt.Time.MarshalText()