diff --git a/pkg/lokiunifi/report_alarm.go b/pkg/lokiunifi/report_alarm.go index 1ae85852..fd874479 100644 --- a/pkg/lokiunifi/report_alarm.go +++ b/pkg/lokiunifi/report_alarm.go @@ -27,9 +27,12 @@ func (r *Report) Alarm(event *unifi.Alarm, logs *Logs) { logs.Streams = append(logs.Streams, LogStream{ Entries: [][]string{{strconv.FormatInt(event.Datetime.UnixNano(), 10), string(msg)}}, Labels: CleanLabels(MergeLabels(map[string]string{ - "application": "unifi_alarm", - "source": event.SourceName, - "site_name": event.SiteName, + "application": "unifi_alarm", + "job": "unpoller", + "source": event.SourceName, + "site_name": event.SiteName, + "event_type": event.Key, + "inner_alert_action": event.InnerAlertAction, }, r.ExtraLabels)), }) } diff --git a/pkg/lokiunifi/report_anomaly.go b/pkg/lokiunifi/report_anomaly.go index d9ca734a..d2eefdd3 100644 --- a/pkg/lokiunifi/report_anomaly.go +++ b/pkg/lokiunifi/report_anomaly.go @@ -28,6 +28,7 @@ func (r *Report) Anomaly(event *unifi.Anomaly, logs *Logs) { Entries: [][]string{{strconv.FormatInt(event.Datetime.UnixNano(), 10), string(msg)}}, Labels: CleanLabels(MergeLabels(map[string]string{ "application": "unifi_anomaly", + "job": "unpoller", "source": event.SourceName, "site_name": event.SiteName, }, r.ExtraLabels)), diff --git a/pkg/lokiunifi/report_event.go b/pkg/lokiunifi/report_event.go index e7680fef..5a7eb58b 100644 --- a/pkg/lokiunifi/report_event.go +++ b/pkg/lokiunifi/report_event.go @@ -29,6 +29,7 @@ func (r *Report) Event(event *unifi.Event, logs *Logs) { Entries: [][]string{{strconv.FormatInt(event.Datetime.UnixNano(), 10), string(msg)}}, Labels: CleanLabels(MergeLabels(map[string]string{ "application": "unifi_event", + "job": "unpoller", "site_name": event.SiteName, "source": event.SourceName, }, r.ExtraLabels)), @@ -54,6 +55,7 @@ func (r *Report) SystemLogEvent(event *unifi.SystemLogEntry, logs *Logs) { Entries: [][]string{{strconv.FormatInt(event.Datetime().UnixNano(), 10), string(msg)}}, Labels: CleanLabels(MergeLabels(map[string]string{ "application": "unifi_system_log", + "job": "unpoller", "site_name": event.SiteName, "source": event.SourceName, "category": event.Category, diff --git a/pkg/lokiunifi/report_ids.go b/pkg/lokiunifi/report_ids.go index 735951c5..74fab782 100644 --- a/pkg/lokiunifi/report_ids.go +++ b/pkg/lokiunifi/report_ids.go @@ -27,9 +27,12 @@ func (r *Report) IDs(event *unifi.IDS, logs *Logs) { logs.Streams = append(logs.Streams, LogStream{ Entries: [][]string{{strconv.FormatInt(event.Datetime.UnixNano(), 10), string(msg)}}, Labels: CleanLabels(MergeLabels(map[string]string{ - "application": "unifi_ids", - "source": event.SourceName, - "site_name": event.SiteName, + "application": "unifi_ids", + "job": "unpoller", + "source": event.SourceName, + "site_name": event.SiteName, + "event_type": event.EventType, + "inner_alert_action": event.InnerAlertAction, }, r.ExtraLabels)), }) } diff --git a/pkg/lokiunifi/report_protect.go b/pkg/lokiunifi/report_protect.go index 7a928e64..9334c48d 100644 --- a/pkg/lokiunifi/report_protect.go +++ b/pkg/lokiunifi/report_protect.go @@ -36,6 +36,7 @@ func (r *Report) ProtectLogEvent(event *unifi.ProtectLogEntry, logs *Logs) { Entries: [][]string{{strconv.FormatInt(event.Datetime().UnixNano(), 10), string(msg)}}, Labels: CleanLabels(MergeLabels(map[string]string{ "application": "unifi_protect_log", + "job": "unpoller", "source": event.SourceName, "event_type": event.GetEventType(), "category": event.GetCategory(), @@ -59,6 +60,7 @@ func (r *Report) ProtectLogEvent(event *unifi.ProtectLogEntry, logs *Logs) { Entries: [][]string{{strconv.FormatInt(event.Datetime().UnixNano()+1, 10), string(thumbnailJSON)}}, Labels: CleanLabels(MergeLabels(map[string]string{ "application": "unifi_protect_thumbnail", + "job": "unpoller", "source": event.SourceName, "event_id": event.ID, "camera": event.Camera,