From b87ee9411154b109df941d3900a253d2e4d6baf6 Mon Sep 17 00:00:00 2001 From: Cody Lee Date: Mon, 4 Mar 2024 18:28:04 -0600 Subject: [PATCH] add hostname per #415 request to loki exports --- pkg/lokiunifi/report_alarm.go | 1 + pkg/lokiunifi/report_event.go | 2 ++ pkg/lokiunifi/report_ids.go | 1 + 3 files changed, 4 insertions(+) diff --git a/pkg/lokiunifi/report_alarm.go b/pkg/lokiunifi/report_alarm.go index 5c039f84..47780dba 100644 --- a/pkg/lokiunifi/report_alarm.go +++ b/pkg/lokiunifi/report_alarm.go @@ -20,6 +20,7 @@ func (r *Report) Alarm(event *unifi.Alarm, logs *Logs) { Entries: [][]string{{strconv.FormatInt(event.Datetime.UnixNano(), 10), event.Msg}}, Labels: CleanLabels(map[string]string{ "application": "unifi_alarm", + "host": event.Host, "source": event.SourceName, "site_name": event.SiteName, "subsystem": event.Subsystem, diff --git a/pkg/lokiunifi/report_event.go b/pkg/lokiunifi/report_event.go index 33037985..3c5aaa72 100644 --- a/pkg/lokiunifi/report_event.go +++ b/pkg/lokiunifi/report_event.go @@ -21,6 +21,8 @@ func (r *Report) Event(event *unifi.Event, logs *Logs) { Labels: CleanLabels(map[string]string{ "application": "unifi_event", "admin": event.Admin, // username + "host": event.Host, + "hostname": event.Hostname, "site_name": event.SiteName, "source": event.SourceName, "subsystem": event.Subsystem, diff --git a/pkg/lokiunifi/report_ids.go b/pkg/lokiunifi/report_ids.go index 4629d253..3ad4fd80 100644 --- a/pkg/lokiunifi/report_ids.go +++ b/pkg/lokiunifi/report_ids.go @@ -21,6 +21,7 @@ func (r *Report) IDS(event *unifi.IDS, logs *Logs) { Labels: CleanLabels(map[string]string{ "application": "unifi_ids", "source": event.SourceName, + "host": event.Host, "site_name": event.SiteName, "subsystem": event.Subsystem, "category": event.Catname,