Skip to content

Commit

Permalink
Fix the issue that checkpoint can't parse large audit log (#1259)
Browse files Browse the repository at this point in the history
  • Loading branch information
lucklove authored Apr 3, 2021
1 parent 9049356 commit c211098
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions pkg/checkpoint/checkpoint.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@ const (
goroutineKey = contextKey("CHECKPOINT_GOROUTINE")
funcKey = "__func__"
hashKey = "__hash__"

// At most 10M for each line in audit log
maxTokenSize = 10 * 1024 * 1024
)

var (
Expand Down Expand Up @@ -125,6 +128,7 @@ func NewCheckPoint(r io.Reader) (*CheckPoint, error) {
cp := CheckPoint{points: make([]map[string]interface{}, 0)}

scanner := bufio.NewScanner(r)
scanner.Buffer(nil, maxTokenSize)
for scanner.Scan() {
line := scanner.Text()
m, err := checkLine(line)
Expand Down

0 comments on commit c211098

Please sign in to comment.