Skip to content

Commit

Permalink
Print warnings on unparseable log file entries.
Browse files Browse the repository at this point in the history
  • Loading branch information
mdevan committed Jul 21, 2023
1 parent 4e96ee6 commit a3211c6
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 3 additions & 1 deletion collector/collect.go
Expand Up @@ -3143,7 +3143,9 @@ func (c *collector) collectFromRDS(o CollectConfig) {
start := time.Now().Add(-window)

err = ac.collectLogs(dbid, start, func(lines []byte) {
c.processLogBuf(start, lines)
if err := c.processLogBuf(start, lines); err != nil {
log.Printf("warning: %v", err)
}
})
}
}
Expand Down
4 changes: 1 addition & 3 deletions collector/log.go
Expand Up @@ -136,12 +136,10 @@ func (c *collector) processLogBuf(start time.Time, bigbuf []byte) (err error) {
count := 0
pos := c.rxPrefix.FindIndex(bigbuf)
for len(pos) == 2 && len(bigbuf) > 0 {
// match again for submatches, can't do this in one go :-(
// TODO: no longer the case, use FindSubmatchIndex
match := c.rxPrefix.FindSubmatch(bigbuf[pos[0]:])
t, user, db, qid, err := getMatchData(match, c.rxPrefix)
if err != nil {
return nil
return err
}
var line string
// seek to start of next line
Expand Down

0 comments on commit a3211c6

Please sign in to comment.