mirror of
https://github.com/crowdsecurity/crowdsec.git
synced 2025-05-11 04:15:54 +02:00
19 lines
439 B
Go
19 lines
439 B
Go
package parser
|
|
|
|
import (
|
|
"encoding/json"
|
|
|
|
log "github.com/sirupsen/logrus"
|
|
|
|
"github.com/crowdsecurity/crowdsec/pkg/types"
|
|
)
|
|
|
|
func unmarshalJSON(field string, p *types.Event, plog *log.Entry) (map[string]string, error) {
|
|
err := json.Unmarshal([]byte(p.Line.Raw), &p.Unmarshaled)
|
|
if err != nil {
|
|
plog.Errorf("could not parse JSON: %s", err)
|
|
return nil, err
|
|
}
|
|
plog.Tracef("unmarshaled JSON: %+v", p.Unmarshaled)
|
|
return nil, nil
|
|
}
|