diff --git a/object.go b/object.go index 4344ee7..481e135 100644 --- a/object.go +++ b/object.go @@ -1,9 +1,8 @@ package jsonlog // Object is the interface that all log objects must implement. -// Each log object has a `type` and `summary` field in its JSON representation. -// The type field is used to identify the object type, and the summary field is -// a human-readable summary of the object's contents. +// Each log object has a `type` field in its JSON representation +// that is used to identify the object type. type Object interface { // EmbeddedHeader returns the header of the log object. EmbeddedHeader() ObjectHeader @@ -13,8 +12,6 @@ type Object interface { // ObjectHeader is the header of a log object. It must be embedded in all log objects. type ObjectHeader struct { - // Summary is a human-readable summary of the object's contents. - Summary string `json:"summary"` // Type is the type of the object. It should be unique across all log objects // and can be used to identify the object type that has embedded this header. Type string `json:"type"` diff --git a/textlog_test.go b/textlog_test.go index 0791080..ac47a13 100644 --- a/textlog_test.go +++ b/textlog_test.go @@ -30,8 +30,7 @@ type SimpleSubstruct struct { func TestToDetails(t *testing.T) { var test = TestObject{ ObjectHeader: ObjectHeader{ - Summary: "TestObject", - Type: "testobject", + Type: "testobject", }, Element1: "element1", Element2: "element2", diff --git a/thorlog/jsonschema/generateschema.go b/thorlog/jsonschema/generateschema.go index 1d2d52c..56ca1aa 100644 --- a/thorlog/jsonschema/generateschema.go +++ b/thorlog/jsonschema/generateschema.go @@ -67,7 +67,6 @@ func makeObjectSchema() (mainEntry string, defs map[string]*jsonschema.Schema) { var logObjectSchema = &jsonschema.Schema{ Properties: orderedmap.New[string, *jsonschema.Schema](), } - logObjectSchema.Properties.Set("summary", &jsonschema.Schema{Type: "string"}) logObjectSchema.Properties.Set("type", &jsonschema.Schema{ Type: "string", Enum: logObjectTypes, diff --git a/thorlog/v3/antivirus.go b/thorlog/v3/antivirus.go index 6dbd29b..8b83eed 100644 --- a/thorlog/v3/antivirus.go +++ b/thorlog/v3/antivirus.go @@ -22,8 +22,7 @@ func init() { AddLogObjectType(typeAntiVirusProduct, &AntiVirusProduct{}) } func NewAntiVirusProduct(name string) *AntiVirusProduct { return &AntiVirusProduct{ LogObjectHeader: jsonlog.ObjectHeader{ - Type: typeAntiVirusProduct, - Summary: name, + Type: typeAntiVirusProduct, }, Name: name, } @@ -45,8 +44,7 @@ func init() { AddLogObjectType(typeAntiVirusExclude, &AntiVirusExclude{}) } func NewAntiVirusExclude(exclusionType string, exclusion string) *AntiVirusExclude { return &AntiVirusExclude{ LogObjectHeader: jsonlog.ObjectHeader{ - Type: typeAntiVirusExclude, - Summary: exclusionType + " " + exclusion, + Type: typeAntiVirusExclude, }, Type: exclusionType, Exclusion: exclusion, diff --git a/thorlog/v3/beaconwatcher.go b/thorlog/v3/beaconwatcher.go index 44d762f..0986389 100644 --- a/thorlog/v3/beaconwatcher.go +++ b/thorlog/v3/beaconwatcher.go @@ -1,7 +1,6 @@ package thorlog import ( - "fmt" "time" "github.com/NextronSystems/jsonlog" @@ -26,8 +25,7 @@ func (NetworkConnectingThread) reportable() {} func NewNetworkConnectingThread(threadId uint32, process *Process) *NetworkConnectingThread { return &NetworkConnectingThread{ ObjectHeader: jsonlog.ObjectHeader{ - Summary: fmt.Sprintf("Thread %d connected to remote servers regularly", threadId), - Type: typeNetworkConnectingThread, + Type: typeNetworkConnectingThread, }, ThreadId: threadId, Process: process, diff --git a/thorlog/v3/dnscache.go b/thorlog/v3/dnscache.go index a599e34..1a39004 100644 --- a/thorlog/v3/dnscache.go +++ b/thorlog/v3/dnscache.go @@ -15,8 +15,7 @@ func init() { AddLogObjectType(typeDnsCacheEntry, &DnsCacheEntry{}) } func NewDnsCacheEntry(host string, ip string) *DnsCacheEntry { return &DnsCacheEntry{ LogObjectHeader: LogObjectHeader{ - Type: typeDnsCacheEntry, - Summary: host, + Type: typeDnsCacheEntry, }, Host: host, IP: ip, diff --git a/thorlog/v3/doublepulsar.go b/thorlog/v3/doublepulsar.go index f0b2db6..428dcfe 100644 --- a/thorlog/v3/doublepulsar.go +++ b/thorlog/v3/doublepulsar.go @@ -1,9 +1,5 @@ package thorlog -import ( - "fmt" -) - type DoublePulsarHandshake struct { LogObjectHeader @@ -20,8 +16,7 @@ func init() { AddLogObjectType(typeDoublePulsarHandshake, &DoublePulsarHandshake func NewDoublePulsarHandshake(handshakeType string, key uint64) *DoublePulsarHandshake { return &DoublePulsarHandshake{ LogObjectHeader: LogObjectHeader{ - Type: typeDoublePulsarHandshake, - Summary: fmt.Sprintf("DoublePulsar Handshake via %s succeeded", handshakeType), + Type: typeDoublePulsarHandshake, }, Key: HexNumber(key), Type: handshakeType, diff --git a/thorlog/v3/envvar.go b/thorlog/v3/envvar.go index a6aefcc..7a6ecc9 100644 --- a/thorlog/v3/envvar.go +++ b/thorlog/v3/envvar.go @@ -19,8 +19,7 @@ func init() { AddLogObjectType(typeEnvironmentVariable, &EnvironmentVariable{}) func NewEnvironmentVariable(variable string, value string) *EnvironmentVariable { return &EnvironmentVariable{ LogObjectHeader: LogObjectHeader{ - Type: typeEnvironmentVariable, - Summary: variable + "=" + value, + Type: typeEnvironmentVariable, }, Variable: variable, Value: value, diff --git a/thorlog/v3/event.go b/thorlog/v3/event.go index 8717f6d..c47c4a0 100644 --- a/thorlog/v3/event.go +++ b/thorlog/v3/event.go @@ -16,6 +16,7 @@ import ( type Finding struct { jsonlog.ObjectHeader Meta LogEventMetadata `json:"meta" textlog:",expand"` + Text string `json:"message" textlog:"-"` Subject ReportableObject `json:"subject" textlog:",expand"` Score int64 `json:"score" textlog:"score"` Reasons []Reason `json:"reasons" textlog:",expand"` @@ -31,7 +32,7 @@ type ReportableObject interface { } func (f *Finding) Message() string { - return f.Summary + return f.Text } func (f *Finding) Version() common.Version { @@ -43,29 +44,20 @@ func (f *Finding) Metadata() *LogEventMetadata { } func (f *Finding) UnmarshalJSON(data []byte) error { + type plainFinding Finding var rawFinding struct { - jsonlog.ObjectHeader - Meta LogEventMetadata `json:"meta"` - Subject EmbeddedObject `json:"subject"` - Score int64 `json:"score"` - Reasons []Reason `json:"reasons"` - EventContext Context `json:"context"` - LogVersion common.Version `json:"log_version"` + plainFinding // Embed without unmarshal method to avoid infinite recursion + Subject EmbeddedObject `json:"subject"` // EmbeddedObject is used to allow unmarshalling of the subject as a ReportableObject } if err := json.Unmarshal(data, &rawFinding); err != nil { return err } - f.ObjectHeader = rawFinding.ObjectHeader - f.Meta = rawFinding.Meta subject, ok := rawFinding.Subject.Object.(ReportableObject) if !ok { return fmt.Errorf("subject must implement the reportable interface") } + *f = Finding(rawFinding.plainFinding) // Copy the fields from rawFinding to f f.Subject = subject - f.Score = rawFinding.Score - f.Reasons = rawFinding.Reasons - f.EventContext = rawFinding.EventContext - f.LogVersion = rawFinding.LogVersion // Resolve all references // When the event is unmarshalled, the references are not resolved yet and only contain the JSON pointers. @@ -163,9 +155,9 @@ func init() { AddLogObjectType(typeFinding, &Finding{}) } func NewFinding(subject ReportableObject, message string) *Finding { return &Finding{ ObjectHeader: LogObjectHeader{ - Type: typeFinding, - Summary: message, + Type: typeFinding, }, + Text: message, Subject: subject, LogVersion: currentVersion, } @@ -174,12 +166,13 @@ func NewFinding(subject ReportableObject, message string) *Finding { type Message struct { jsonlog.ObjectHeader Meta LogEventMetadata `json:"meta" textlog:",expand"` + Text string `json:"message" textlog:"-"` Fields MessageFields `json:"fields" textlog:",expand" jsonschema:"nullable"` LogVersion common.Version `json:"log_version"` } func (m *Message) Message() string { - return m.Summary + return m.Text } func (m *Message) Version() common.Version { @@ -199,9 +192,9 @@ func init() { AddLogObjectType(typeMessage, &Message{}) } func NewMessage(meta LogEventMetadata, message string, kvs ...any) *Message { msg := &Message{ ObjectHeader: LogObjectHeader{ - Type: typeMessage, - Summary: message, + Type: typeMessage, }, + Text: message, Meta: meta, LogVersion: currentVersion, } diff --git a/thorlog/v3/event_test.go b/thorlog/v3/event_test.go index 9803c70..fa7807c 100644 --- a/thorlog/v3/event_test.go +++ b/thorlog/v3/event_test.go @@ -92,7 +92,7 @@ func concatEntry(entry jsonlog.TextlogEntry) string { func TestFinding_UnmarshalJSON(t *testing.T) { for i, finding := range []*Finding{ { - ObjectHeader: LogObjectHeader{Type: typeFinding, Summary: "message"}, + ObjectHeader: LogObjectHeader{Type: typeFinding}, Meta: LogEventMetadata{ Lvl: common.Alert, Mod: "Test", @@ -100,6 +100,7 @@ func TestFinding_UnmarshalJSON(t *testing.T) { GenID: "abdas", Source: "aserarsd", }, + Text: "This is a test finding", Subject: NewFile("path/to/file"), EventContext: Context{ { diff --git a/thorlog/v3/eventlog.go b/thorlog/v3/eventlog.go index 94e73cf..3ed4835 100644 --- a/thorlog/v3/eventlog.go +++ b/thorlog/v3/eventlog.go @@ -1,7 +1,6 @@ package thorlog import ( - "strconv" "time" "github.com/NextronSystems/jsonlog" @@ -51,8 +50,7 @@ func init() { AddLogObjectType(TypeProcessStart, &EventlogProcessStart{}) } func NewEventlogProcessStart(process string, startTimes []time.Time) *EventlogProcessStart { return &EventlogProcessStart{ ObjectHeader: jsonlog.ObjectHeader{ - Type: TypeProcessStart, - Summary: process + " started " + strconv.Itoa(len(startTimes)) + " times", + Type: TypeProcessStart, }, Process: process, StartTimes: startTimes, diff --git a/thorlog/v3/file.go b/thorlog/v3/file.go index 9777828..88daad3 100644 --- a/thorlog/v3/file.go +++ b/thorlog/v3/file.go @@ -179,8 +179,7 @@ func init() { AddLogObjectType(typeFile, &File{}) } func NewFile(path string) *File { return &File{ ObjectHeader: jsonlog.ObjectHeader{ - Type: typeFile, - Summary: path, + Type: typeFile, }, Path: path, } diff --git a/thorlog/v3/firewall.go b/thorlog/v3/firewall.go index d123fce..96f8970 100644 --- a/thorlog/v3/firewall.go +++ b/thorlog/v3/firewall.go @@ -48,8 +48,7 @@ func init() { AddLogObjectType(typeRawFirewallRule, &RawFirewallRule{}) } func NewRawFirewallRule(rule string) *RawFirewallRule { return &RawFirewallRule{ ObjectHeader: jsonlog.ObjectHeader{ - Type: typeRawFirewallRule, - Summary: rule, + Type: typeRawFirewallRule, }, Rule: rule, } diff --git a/thorlog/v3/groupsxml.go b/thorlog/v3/groupsxml.go index 2e58127..f88eee0 100644 --- a/thorlog/v3/groupsxml.go +++ b/thorlog/v3/groupsxml.go @@ -20,8 +20,7 @@ func init() { AddLogObjectType(typeGroupsXmlPassword, &GroupsXmlUser{}) } func NewGroupsXmlPassword(file, user, password string) *GroupsXmlUser { return &GroupsXmlUser{ ObjectHeader: jsonlog.ObjectHeader{ - Type: typeGroupsXmlPassword, - Summary: user, + Type: typeGroupsXmlPassword, }, File: file, User: user, diff --git a/thorlog/v3/hostinfo.go b/thorlog/v3/hostinfo.go index adeef1d..975e12a 100644 --- a/thorlog/v3/hostinfo.go +++ b/thorlog/v3/hostinfo.go @@ -31,8 +31,7 @@ func init() { AddLogObjectType(typeHostInfo, &HostInfo{}) } func NewHostInfo() *HostInfo { return &HostInfo{ ObjectHeader: jsonlog.ObjectHeader{ - Type: typeHostInfo, - Summary: "System Information", + Type: typeHostInfo, }, } } @@ -115,8 +114,7 @@ func init() { AddLogObjectType(typePlatformInfoMacos, &PlatformInfoMacos{}) } func NewMacOSPlatformInfo() *PlatformInfoMacos { return &PlatformInfoMacos{ ObjectHeader: jsonlog.ObjectHeader{ - Type: typePlatformInfoMacos, - Summary: "MacOS specific Information", + Type: typePlatformInfoMacos, }, } } @@ -140,8 +138,7 @@ func init() { AddLogObjectType(typePlatformInfoLinux, &PlatformInfoLinux{}) } func NewLinuxPlatformInfo() *PlatformInfoLinux { return &PlatformInfoLinux{ ObjectHeader: jsonlog.ObjectHeader{ - Type: typePlatformInfoLinux, - Summary: "Linux specific Information", + Type: typePlatformInfoLinux, }, } } @@ -167,8 +164,7 @@ func init() { AddLogObjectType(typePlatformInfoWindows, &PlatformInfoWindows{}) func NewWindowsPlatformInfo() *PlatformInfoWindows { return &PlatformInfoWindows{ ObjectHeader: jsonlog.ObjectHeader{ - Type: typePlatformInfoWindows, - Summary: "Windows specific Information", + Type: typePlatformInfoWindows, }, } } diff --git a/thorlog/v3/hostsfile.go b/thorlog/v3/hostsfile.go index c3f565c..35667bf 100644 --- a/thorlog/v3/hostsfile.go +++ b/thorlog/v3/hostsfile.go @@ -15,8 +15,7 @@ func init() { AddLogObjectType(typeHostsFileEntry, &HostsFileEntry{}) } func NewHostsFileEntry(host string, ip string) *HostsFileEntry { return &HostsFileEntry{ LogObjectHeader: LogObjectHeader{ - Type: typeHostsFileEntry, - Summary: host, + Type: typeHostsFileEntry, }, Host: host, IP: ip, diff --git a/thorlog/v3/jumplist.go b/thorlog/v3/jumplist.go index 2553ba9..45aabe7 100644 --- a/thorlog/v3/jumplist.go +++ b/thorlog/v3/jumplist.go @@ -31,8 +31,7 @@ func init() { AddLogObjectType(typeJumplistEntry, &JumplistEntry{}) } func NewJumplistEntry(path string) *JumplistEntry { return &JumplistEntry{ ObjectHeader: jsonlog.ObjectHeader{ - Type: typeJumplistEntry, - Summary: path, + Type: typeJumplistEntry, }, Path: path, } diff --git a/thorlog/v3/kernelmodule.go b/thorlog/v3/kernelmodule.go index 0f02adb..12c427a 100644 --- a/thorlog/v3/kernelmodule.go +++ b/thorlog/v3/kernelmodule.go @@ -26,8 +26,7 @@ const typeLinuxKernelModule = "Linux Kernel Module" func NewLinuxKernelModule(name string) *LinuxKernelModule { return &LinuxKernelModule{ LogObjectHeader: LogObjectHeader{ - Type: typeLinuxKernelModule, - Summary: name, + Type: typeLinuxKernelModule, }, Name: name, } diff --git a/thorlog/v3/mplog.go b/thorlog/v3/mplog.go index fc985d0..c5e276a 100644 --- a/thorlog/v3/mplog.go +++ b/thorlog/v3/mplog.go @@ -1,7 +1,6 @@ package thorlog import ( - "fmt" "time" "github.com/NextronSystems/jsonlog" @@ -25,8 +24,7 @@ func init() { AddLogObjectType(typeDetectionAdd, &DetectionAddEntry{}) } func NewDetectionAddEntry(t time.Time, threat string, detected KeyValueList) *DetectionAddEntry { return &DetectionAddEntry{ ObjectHeader: jsonlog.ObjectHeader{ - Type: "DETECTION_ADD MPLog entry", - Summary: fmt.Sprintf("Detected threat %q", threat), + Type: "DETECTION_ADD MPLog entry", }, Time: t, ThreatName: threat, @@ -53,8 +51,7 @@ func init() { AddLogObjectType(typeEstimatedImpact, &EstimatedImpactEntry{}) } func NewEstimatedImpactEntry(t time.Time, image string, pid int, file string) *EstimatedImpactEntry { return &EstimatedImpactEntry{ ObjectHeader: jsonlog.ObjectHeader{ - Type: typeEstimatedImpact, - Summary: fmt.Sprintf("Process %q accessed file %q", image, file), + Type: typeEstimatedImpact, }, Time: t, ProcessImageName: image, @@ -82,8 +79,7 @@ func init() { AddLogObjectType(typeSdnQuery, &SdnQueryEntry{}) } func NewSdnQueryEntry(t time.Time, file string, sha1 string, sha256 string) *SdnQueryEntry { return &SdnQueryEntry{ ObjectHeader: jsonlog.ObjectHeader{ - Type: typeSdnQuery, - Summary: fmt.Sprintf("SDN query for file %q", file), + Type: typeSdnQuery, }, Time: t, Filepath: file, @@ -110,8 +106,7 @@ func init() { AddLogObjectType(typeEmsDetection, &EmsDetectionEntry{}) } func NewEmsDetection(timestamp time.Time, threatName string, pid int) *EmsDetectionEntry { return &EmsDetectionEntry{ ObjectHeader: jsonlog.ObjectHeader{ - Type: "EMS detection MPLog entry", - Summary: fmt.Sprintf("Detected threat %q in process %d", threatName, pid), + Type: "EMS detection MPLog entry", }, Time: timestamp, ThreatName: threatName, diff --git a/thorlog/v3/networkshares.go b/thorlog/v3/networkshares.go index a88a299..e2c3b9a 100644 --- a/thorlog/v3/networkshares.go +++ b/thorlog/v3/networkshares.go @@ -20,8 +20,7 @@ func init() { AddLogObjectType(typeNetworkShare, &NetworkShare{}) } func NewNetworkShare(name, path string) *NetworkShare { return &NetworkShare{ ObjectHeader: jsonlog.ObjectHeader{ - Type: typeNetworkShare, - Summary: name, + Type: typeNetworkShare, }, Name: name, Path: path, diff --git a/thorlog/v3/patches.go b/thorlog/v3/patches.go index 3654f2d..66b1dc9 100644 --- a/thorlog/v3/patches.go +++ b/thorlog/v3/patches.go @@ -20,8 +20,7 @@ func init() { AddLogObjectType(typeHotfixSummary, &HotfixSummary{}) } func NewHotfixSummary(lastHotfix time.Time) *HotfixSummary { return &HotfixSummary{ ObjectHeader: LogObjectHeader{ - Type: typeHotfixSummary, - Summary: "last hotfix installed " + lastHotfix.Format("2006-01-02"), + Type: typeHotfixSummary, }, LastHotfix: lastHotfix, } @@ -43,8 +42,7 @@ func init() { AddLogObjectType(typeEndOfLifeReport, &EndOfLifeReport{}) } func NewEndOfLifeReport(version string, endOfLife time.Time) *EndOfLifeReport { return &EndOfLifeReport{ ObjectHeader: LogObjectHeader{ - Type: typeEndOfLifeReport, - Summary: "end of life for " + version + " was " + endOfLife.Format("2006-01-02"), + Type: typeEndOfLifeReport, }, Version: version, EndOfLife: endOfLife, diff --git a/thorlog/v3/pipe.go b/thorlog/v3/pipe.go index aebb5ee..36dab71 100644 --- a/thorlog/v3/pipe.go +++ b/thorlog/v3/pipe.go @@ -19,8 +19,7 @@ func init() { AddLogObjectType(typeWindowsPipe, &WindowsPipe{}) } func NewWindowsPipe(pipe string) *WindowsPipe { return &WindowsPipe{ LogObjectHeader: LogObjectHeader{ - Type: typeWindowsPipe, - Summary: pipe, + Type: typeWindowsPipe, }, Pipe: pipe, } diff --git a/thorlog/v3/process.go b/thorlog/v3/process.go index 7082ddb..73e1029 100644 --- a/thorlog/v3/process.go +++ b/thorlog/v3/process.go @@ -84,8 +84,7 @@ func init() { AddLogObjectType(typeProcess, &Process{}) } func NewProcess(pid int32) *Process { return &Process{ ObjectHeader: jsonlog.ObjectHeader{ - Type: typeProcess, - Summary: fmt.Sprintf("PID %d", pid), + Type: typeProcess, }, Pid: pid, } diff --git a/thorlog/v3/reason.go b/thorlog/v3/reason.go index 06437d3..c8edc77 100644 --- a/thorlog/v3/reason.go +++ b/thorlog/v3/reason.go @@ -10,7 +10,7 @@ import ( type Reason struct { jsonlog.ObjectHeader - Summary string `json:"-" textlog:"reason"` + Summary string `json:"summary" textlog:"reason"` Signature `json:"signature" textlog:",inline"` StringMatches MatchStrings `json:"matched" textlog:"matched" jsonschema:"nullable"` @@ -21,7 +21,6 @@ func (r *Reason) UnmarshalJSON(data []byte) error { if err := json.Unmarshal(data, (*plainReason)(r)); err != nil { return err } - r.Summary = r.ObjectHeader.Summary return nil } @@ -108,8 +107,7 @@ func (s Sigtype) JSONSchemaAlias() any { return "" } func NewReason(desc string, signature Signature, matches MatchStrings) Reason { return Reason{ ObjectHeader: jsonlog.ObjectHeader{ - Type: typeReason, - Summary: desc, + Type: typeReason, }, Summary: desc, Signature: signature, diff --git a/thorlog/v3/registry.go b/thorlog/v3/registry.go index 885a775..2bde580 100644 --- a/thorlog/v3/registry.go +++ b/thorlog/v3/registry.go @@ -1,7 +1,6 @@ package thorlog import ( - "fmt" "time" "github.com/NextronSystems/jsonlog" @@ -96,8 +95,7 @@ func init() { AddLogObjectType(TypeRegisteredDebugger, &RegisteredDebugger{}) } func NewRegisteredDebugger(target string, debugger string) *RegisteredDebugger { return &RegisteredDebugger{ ObjectHeader: jsonlog.ObjectHeader{ - Type: TypeRegisteredDebugger, - Summary: fmt.Sprintf("%q registered as debugger for %q", debugger, target), + Type: TypeRegisteredDebugger, }, Executable: target, Debugger: debugger, diff --git a/thorlog/v3/scaninfo.go b/thorlog/v3/scaninfo.go index d67d54f..2c07fae 100644 --- a/thorlog/v3/scaninfo.go +++ b/thorlog/v3/scaninfo.go @@ -39,8 +39,7 @@ func init() { AddLogObjectType(typeScanInfo, &ScanInfo{}) } func NewScanInfo() *ScanInfo { return &ScanInfo{ ObjectHeader: jsonlog.ObjectHeader{ - Type: typeScanInfo, - Summary: "Information about THOR invocation", + Type: typeScanInfo, }, } } diff --git a/thorlog/v3/thread.go b/thorlog/v3/thread.go index 3c0e5f4..85b3e02 100644 --- a/thorlog/v3/thread.go +++ b/thorlog/v3/thread.go @@ -1,8 +1,6 @@ package thorlog import ( - "fmt" - "github.com/NextronSystems/jsonlog" ) @@ -21,8 +19,7 @@ func init() { AddLogObjectType(typeThread, &Thread{}) } func NewThread(tid uint32) *Thread { return &Thread{ ObjectHeader: jsonlog.ObjectHeader{ - Type: typeThread, - Summary: fmt.Sprintf("Thread %d", tid), + Type: typeThread, }, ThreadId: tid, } diff --git a/thorlog/v3/tomcatusers.go b/thorlog/v3/tomcatusers.go index c9f7372..c22ef2f 100644 --- a/thorlog/v3/tomcatusers.go +++ b/thorlog/v3/tomcatusers.go @@ -19,8 +19,7 @@ func init() { AddLogObjectType(typeTomcatUser, &TomcatUser{}) } func NewTomcatUser(user, file string) *TomcatUser { return &TomcatUser{ ObjectHeader: jsonlog.ObjectHeader{ - Summary: "User " + user, - Type: typeTomcatUser, + Type: typeTomcatUser, }, User: user, File: file, diff --git a/thorlog/v3/unmarshal.go b/thorlog/v3/unmarshal.go index cbf6fca..950ce8f 100644 --- a/thorlog/v3/unmarshal.go +++ b/thorlog/v3/unmarshal.go @@ -101,20 +101,11 @@ func (e *EmbeddedObject) UnmarshalJSON(data []byte) error { return ErrNoLogObject } - objectSummary, exists := details["summary"] - if !exists { - return ErrNoLogObject - } - _, isString = objectSummary.(string) - if !isString { - return ErrNoLogObject - } - objectBlank := LogObjectTypes[objectTypeString] if objectBlank == nil { e.Object = &UnknownObject{ Data: details, - ObjectHeader: jsonlog.ObjectHeader{Type: objectTypeString, Summary: objectSummary.(string)}, + ObjectHeader: jsonlog.ObjectHeader{Type: objectTypeString}, } return nil } @@ -123,10 +114,6 @@ func (e *EmbeddedObject) UnmarshalJSON(data []byte) error { decoder := json.NewDecoder(bytes.NewReader(data)) decoder.DisallowUnknownFields() err = decoder.Decode(object) - if err != nil { - return err - } - if err != nil { return err } diff --git a/thorlog/v3/users.go b/thorlog/v3/users.go index 0d51060..39d6fcd 100644 --- a/thorlog/v3/users.go +++ b/thorlog/v3/users.go @@ -24,8 +24,7 @@ func init() { AddLogObjectType(typeLoggedInUser, &LoggedInUser{}) } func NewLoggedInUser(user string) *LoggedInUser { return &LoggedInUser{ LogObjectHeader: LogObjectHeader{ - Type: typeLoggedInUser, - Summary: user, + Type: typeLoggedInUser, }, User: user, } @@ -49,8 +48,7 @@ func init() { AddLogObjectType(typeUserProfile, &ProfileFolder{}) } func NewProfileFolder(user string) *ProfileFolder { return &ProfileFolder{ LogObjectHeader: LogObjectHeader{ - Type: typeUserProfile, - Summary: user, + Type: typeUserProfile, }, User: user, } @@ -78,8 +76,7 @@ func init() { AddLogObjectType(typeUnixUser, &UnixUser{}) } func NewUnixUser(name string) *UnixUser { return &UnixUser{ LogObjectHeader: LogObjectHeader{ - Type: typeUnixUser, - Summary: name, + Type: typeUnixUser, }, Name: name, } @@ -110,8 +107,7 @@ func init() { AddLogObjectType(typeWindowsUser, &WindowsUser{}) } func NewWindowsUser(user string) *WindowsUser { return &WindowsUser{ LogObjectHeader: LogObjectHeader{ - Type: typeWindowsUser, - Summary: user, + Type: typeWindowsUser, }, User: user, } diff --git a/thorlog/v3/winkernel.go b/thorlog/v3/winkernel.go index b4ca436..0b54143 100644 --- a/thorlog/v3/winkernel.go +++ b/thorlog/v3/winkernel.go @@ -14,8 +14,7 @@ func init() { AddLogObjectType(typeWindowsEvent, &WindowsEvent{}) } func NewWindowsEvent(event string) *WindowsEvent { return &WindowsEvent{ LogObjectHeader: LogObjectHeader{ - Type: typeWindowsEvent, - Summary: event, + Type: typeWindowsEvent, }, Event: event, } @@ -36,8 +35,7 @@ func init() { AddLogObjectType(typeWindowsMutex, &WindowsMutex{}) } func NewWindowsMutex(mutex string) *WindowsMutex { return &WindowsMutex{ LogObjectHeader: LogObjectHeader{ - Type: typeWindowsMutex, - Summary: mutex, + Type: typeWindowsMutex, }, Mutex: mutex, }