From 40d39f0939fed6257b527b8462d7ec4e2d99710b Mon Sep 17 00:00:00 2001 From: Camden Cheek Date: Fri, 17 Jul 2020 17:22:00 -0400 Subject: [PATCH] Make journald emit map[string]interface{} --- plugin/builtin/input/journald.go | 6 +++--- plugin/builtin/input/journald_test.go | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/plugin/builtin/input/journald.go b/plugin/builtin/input/journald.go index 34e2ba4f9..91381f794 100644 --- a/plugin/builtin/input/journald.go +++ b/plugin/builtin/input/journald.go @@ -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 @@ -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) } @@ -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() { diff --git a/plugin/builtin/input/journald_test.go b/plugin/builtin/input/journald_test.go index f5f27345c..1f1c1fc32 100644 --- a/plugin/builtin/input/journald_test.go +++ b/plugin/builtin/input/journald_test.go @@ -63,7 +63,7 @@ func TestInputJournald(t *testing.T) { err = journaldInput.Start() require.NoError(t, err) - expected := map[string]string{ + expected := map[string]interface{}{ "_BOOT_ID": "c4fa36de06824d21835c05ff80c54468", "_CAP_EFFECTIVE": "0", "_TRANSPORT": "journal",