Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion thorlog/common/event.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,17 @@ const (
Debug LogLevel = "Debug"
)

// LogEventMetadata contains the metadata of a log event.
// It is used to store common fields that are available in all log events.
//
// In a textlog formatted event, some of these fields are part of the header and do
// not occur "normally" as a KEY: VALUE pair in the event body.
// These fields are marked with the `textlog:"-"` tag to prevent them from being
// included in the event body.
type LogEventMetadata struct {
Time time.Time `json:"time" textlog:"-"`
Lvl LogLevel `json:"level" textlog:"-"`
Mod string `json:"module" textlog:"-"`
Mod string `json:"module" textlog:"module"`
ScanID string `json:"scan_id" textlog:"scanid,omitempty"`
GenID string `json:"event_id" textlog:"uid,omitempty"`
Source string `json:"hostname" textlog:"-"`
Expand Down
2 changes: 1 addition & 1 deletion thorlog/v1/event.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ func (e Event) MarshalJSON() ([]byte, error) {
type Metadata struct {
Time time.Time `json:"time" textlog:"-"`
Lvl common.LogLevel `json:"level" textlog:"-"`
Mod string `json:"module" textlog:"-"`
Mod string `json:"module" textlog:"module"`
ScanID string `json:"scanid" textlog:"scanid,omitempty"`
GenID string `json:"uid" textlog:"uid,omitempty"`
Source string `json:"hostname" textlog:"-"`
Expand Down
2 changes: 1 addition & 1 deletion thorlog/v2/event.go
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ func (e Event) MarshalJSON() ([]byte, error) {
type Metadata struct {
Time time.Time `json:"time" textlog:"-"`
Lvl common.LogLevel `json:"level" textlog:"-"`
Mod string `json:"module" textlog:"-"`
Mod string `json:"module" textlog:"module"`
ScanID string `json:"scanid" textlog:"scanid,omitempty"`
GenID string `json:"uid" textlog:"uid,omitempty"`
Source string `json:"hostname" textlog:"-"`
Expand Down
4 changes: 2 additions & 2 deletions thorlog/v3/event.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import (
type Finding struct {
jsonlog.ObjectHeader
Meta LogEventMetadata `json:"meta" textlog:",expand"`
Text string `json:"message" textlog:"-"`
Text string `json:"message" textlog:"message"`
Subject ReportableObject `json:"subject" textlog:",expand"`
Score int64 `json:"score" textlog:"score"`
Reasons []Reason `json:"reasons" textlog:",expand"`
Expand Down Expand Up @@ -166,7 +166,7 @@ func NewFinding(subject ReportableObject, message string) *Finding {
type Message struct {
jsonlog.ObjectHeader
Meta LogEventMetadata `json:"meta" textlog:",expand"`
Text string `json:"message" textlog:"-"`
Text string `json:"message" textlog:"message"`
Fields MessageFields `json:"fields" textlog:",expand" jsonschema:"nullable"`
LogVersion common.Version `json:"log_version"`
}
Expand Down