Skip to content

Commit

Permalink
Make journald emit map[string]interface{}
Browse files Browse the repository at this point in the history
  • Loading branch information
camdencheek committed Jul 17, 2020
1 parent 89dbd2e commit 17e18fc
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions plugin/builtin/input/journald.go
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ func (plugin *JournaldInput) Start() error {
}

func (plugin *JournaldInput) parseJournalEntry(line []byte) (*entry.Entry, string, error) {
var record map[string]string
var record map[string]interface{}
err := plugin.json.Unmarshal(line, &record)
if err != nil {
return nil, "", err
Expand All @@ -173,7 +173,7 @@ func (plugin *JournaldInput) parseJournalEntry(line []byte) (*entry.Entry, strin
return nil, "", errors.New("journald record missing __REALTIME_TIMESTAMP field")
}

timestampInt, err := strconv.ParseInt(timestamp, 10, 64)
timestampInt, err := strconv.ParseInt(timestamp.(string), 10, 64)
if err != nil {
return nil, "", fmt.Errorf("parse timestamp: %s", err)
}
Expand All @@ -187,7 +187,7 @@ func (plugin *JournaldInput) parseJournalEntry(line []byte) (*entry.Entry, strin

entry := plugin.NewEntry(record)
entry.Timestamp = time.Unix(0, timestampInt*1000) // in microseconds
return entry, cursor, nil
return entry, cursor.(string), nil
}

func (plugin *JournaldInput) syncOffsets() {
Expand Down

0 comments on commit 17e18fc

Please sign in to comment.