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
73 changes: 34 additions & 39 deletions backend/modules/alerts/domain/alert.go
Original file line number Diff line number Diff line change
Expand Up @@ -115,46 +115,41 @@ type Impact struct {
Availability int `json:"availability,omitempty"`
}

type AlertEvent struct {
ID string `json:"id,omitempty"`
Timestamp string `json:"timestamp,omitempty"`
}

type UtmAlert struct {
TenantID string `json:"tenantId,omitempty"`
TenantName string `json:"tenantName,omitempty"`
Timestamp string `json:"@timestamp,omitempty"`
LastUpdate string `json:"lastUpdate,omitempty"`
ID string `json:"id,omitempty"`
ParentID string `json:"parentId,omitempty"`
Name string `json:"name,omitempty"`
Category string `json:"category,omitempty"`
Technique string `json:"technique,omitempty"`
Description string `json:"description,omitempty"`
Solution string `json:"solution,omitempty"`
DataType string `json:"dataType,omitempty"`
DataSource string `json:"dataSource,omitempty"`
Severity AlertSeverity `json:"severity,omitempty"`
Status AlertStatus `json:"status,omitempty"`
StatusObservation string `json:"statusObservation,omitempty"`
Impact *Impact `json:"impact,omitempty"`
ImpactScore int `json:"impactScore,omitempty"`
Echoes int64 `json:"echoes,omitempty"`
Adversary *Side `json:"adversary,omitempty"`
Target *Side `json:"target,omitempty"`
LastEvent json.RawMessage `json:"lastEvent,omitempty"`
Events []AlertEvent `json:"events,omitempty"`
References []string `json:"references,omitempty"`
DeduplicateBy []string `json:"deduplicateBy,omitempty"`
GroupBy []string `json:"groupBy,omitempty"`
Errors []string `json:"errors,omitempty"`
IsIncident bool `json:"isIncident,omitempty"`
IncidentDetail *IncidentDetail `json:"incidentDetail,omitempty"`
Tags []string `json:"tags,omitempty"`
TagRulesApplied []string `json:"tagRulesApplied,omitempty"`
Notes string `json:"notes,omitempty"`
Assignee string `json:"assignee,omitempty"`
History []AlertHistory `json:"history,omitempty"`
TenantID string `json:"tenantId,omitempty"`
TenantName string `json:"tenantName,omitempty"`
Timestamp string `json:"@timestamp,omitempty"`
LastUpdate string `json:"lastUpdate,omitempty"`
ID string `json:"id,omitempty"`
ParentID string `json:"parentId,omitempty"`
Name string `json:"name,omitempty"`
Category string `json:"category,omitempty"`
Technique string `json:"technique,omitempty"`
Description string `json:"description,omitempty"`
Solution string `json:"solution,omitempty"`
DataType string `json:"dataType,omitempty"`
DataSource string `json:"dataSource,omitempty"`
Severity AlertSeverity `json:"severity,omitempty"`
Status AlertStatus `json:"status,omitempty"`
StatusObservation string `json:"statusObservation,omitempty"`
Impact *Impact `json:"impact,omitempty"`
ImpactScore int `json:"impactScore,omitempty"`
Echoes int64 `json:"echoes,omitempty"`
Adversary *Side `json:"adversary,omitempty"`
Target *Side `json:"target,omitempty"`
LastEvent json.RawMessage `json:"lastEvent,omitempty"`
Events []json.RawMessage `json:"events,omitempty"`
References []string `json:"references,omitempty"`
DeduplicateBy []string `json:"deduplicateBy,omitempty"`
GroupBy []string `json:"groupBy,omitempty"`
Errors []string `json:"errors,omitempty"`
IsIncident bool `json:"isIncident,omitempty"`
IncidentDetail *IncidentDetail `json:"incidentDetail,omitempty"`
Tags []string `json:"tags,omitempty"`
TagRulesApplied []string `json:"tagRulesApplied,omitempty"`
Notes string `json:"notes,omitempty"`
Assignee string `json:"assignee,omitempty"`
History []AlertHistory `json:"history,omitempty"`
}

type AlertHistory struct {
Expand Down
7 changes: 4 additions & 3 deletions backend/modules/alerts/usecase/related_logs.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,10 @@ func (u *alertUsecase) RelatedLogs(ctx context.Context, alertID string) (*dto.Re
}
for i := range echoes {
span(parseAlertTime(echoes[i].Timestamp))
for _, ev := range echoes[i].Events {
add(ev.ID)
span(parseAlertTime(ev.Timestamp))
for _, raw := range echoes[i].Events {
ev := gjson.ParseBytes(raw)
add(ev.Get("id").String())
span(eventTime(ev))
}
if len(echoes[i].LastEvent) > 0 {
le := gjson.ParseBytes(echoes[i].LastEvent)
Expand Down
Loading