2022-12-06 12:47:29 +00:00
|
|
|
package parser
|
|
|
|
|
|
|
|
import (
|
|
|
|
"encoding/json"
|
|
|
|
|
|
|
|
log "github.com/sirupsen/logrus"
|
2023-06-13 11:16:13 +00:00
|
|
|
|
|
|
|
"github.com/crowdsecurity/crowdsec/pkg/types"
|
2022-12-06 12:47:29 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
func unmarshalJSON(field string, p *types.Event, ctx interface{}, plog *log.Entry) (map[string]string, error) {
|
|
|
|
err := json.Unmarshal([]byte(p.Line.Raw), &p.Unmarshaled)
|
|
|
|
if err != nil {
|
|
|
|
plog.Errorf("could not unmarshal JSON: %s", err)
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
plog.Tracef("unmarshaled JSON: %+v", p.Unmarshaled)
|
|
|
|
return nil, nil
|
|
|
|
}
|
|
|
|
|
|
|
|
func unmarshalInit(cfg map[string]string) (interface{}, error) {
|
|
|
|
return nil, nil
|
|
|
|
}
|