Skip to content

Commit

Permalink
I-16 -- Place time field of journald record to top level of entry.
Browse files Browse the repository at this point in the history
  • Loading branch information
furiousassault committed Nov 16, 2021
1 parent d06989a commit e1a09d4
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions dispatcher/workers/worker_journald.go
Original file line number Diff line number Diff line change
Expand Up @@ -115,15 +115,14 @@ func (worker *workerJournald) entryProceed() error {
}

entryMap["SYSTEMD_UNIT"] = entryMap["_SYSTEMD_UNIT"]
entryMap[common.LabelTime] = time.Unix(0, usec*int64(time.Microsecond)).Format(time.RFC3339)

entryMap = entryMap.Filter(
"SYSLOG_IDENTIFIER",
"PRIORITY",
"SYSLOG_PID",
"SYSLOG_FACILITY",
"SYSTEMD_UNIT",
"MESSAGE",
common.LabelTime,
)

if worker.config.UserLogFieldsKey != "" {
Expand All @@ -138,6 +137,7 @@ func (worker *workerJournald) entryProceed() error {
result.Extend(worker.extends)
}

result[common.LabelTime] = time.Unix(0, usec*int64(time.Microsecond)).Format(time.RFC3339)
entryByteString, err := json.Marshal(result)

if err != nil {
Expand Down

0 comments on commit e1a09d4

Please sign in to comment.