Skip to content

Commit eafab75

Browse files
committed
Skip incorrect json
1 parent 673439e commit eafab75

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

exporter/exporter.go

+6-1
Original file line numberDiff line numberDiff line change
@@ -138,10 +138,15 @@ func (p *Exporter) processFileUpdate(path string) error {
138138
}
139139

140140
// This means that we have mislocated the read and can no longer continue execution
141-
if !bytes.HasPrefix(line, []byte{'{'}) || !bytes.HasSuffix(line, []byte{'}', '\n'}) {
141+
if !bytes.HasSuffix(line, []byte{'}', '\n'}) {
142142
return fmt.Errorf("malformed log entry: %q", line)
143143
}
144144

145+
if !bytes.HasPrefix(line, []byte{'{'}) {
146+
p.offset += int64(len(line))
147+
continue
148+
}
149+
145150
var event auditv1.Event
146151
if err := json.Unmarshal(line, &event); err != nil {
147152
return fmt.Errorf("json decode error: %w", err)

0 commit comments

Comments
 (0)