Skip to content
Merged
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
51 changes: 5 additions & 46 deletions thorlog/v3/plugin.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,16 @@ import (
"github.com/NextronSystems/jsonlog"
)

// PluginStructuredData contains data that was passed to THOR by a plugin in order to be scanned.
//
// The keys and values in the given Data are defined by the plugin and thus cannot be known beforehand.
type PluginStructuredData struct {
jsonlog.ObjectHeader

// The plugin that passed the data to THOR
Plugin string `json:"plugin" textlog:"-"`

// The data that was passed to THOR by the plugin
Data KeyValueList `json:"data" textlog:",inline"`
}

Expand All @@ -26,49 +31,3 @@ func NewPluginStructuredData(plugin string) *PluginStructuredData {
Plugin: plugin,
}
}

type PluginString struct {
jsonlog.ObjectHeader

Plugin string `json:"plugin" textlog:"-"`

String string `json:"string" textlog:"string"`
}

func (PluginString) observed() {}

const typePluginString = "data from plugin"

func init() { AddLogObjectType(typePluginString, &PluginString{}) }

func NewPluginString(plugin string) *PluginString {
return &PluginString{
ObjectHeader: jsonlog.ObjectHeader{
Type: typePluginString,
},
Plugin: plugin,
}
}

type PluginFinding struct {
LogObjectHeader

Plugin string `json:"plugin" textlog:"-"`

LogDetails MessageFields `json:"details" textlog:",expand"`
}

func (PluginFinding) observed() {}

const typePluginFinding = "finding from plugin"

func init() { AddLogObjectType(typePluginFinding, &PluginFinding{}) }

func NewPluginFinding(plugin string) *PluginFinding {
return &PluginFinding{
LogObjectHeader: jsonlog.ObjectHeader{
Type: typePluginFinding,
},
Plugin: plugin,
}
}