Merge pull request #756 from unpoller/dependabot/go_modules/github.com/prometheus/client_golang-1.20.3
Bump github.com/prometheus/client_golang from 1.19.1 to 1.20.3
This commit is contained in:
		
						commit
						85a6b5d580
					
				|  | @ -48,4 +48,4 @@ jobs: | ||||||
|         uses: golangci/golangci-lint-action@v6 |         uses: golangci/golangci-lint-action@v6 | ||||||
|         with: |         with: | ||||||
|           # Required: the version of golangci-lint is required and must be specified without patch version: we always use the latest patch version. |           # Required: the version of golangci-lint is required and must be specified without patch version: we always use the latest patch version. | ||||||
|           version: v1.54 |           version: v1.60 | ||||||
|  |  | ||||||
							
								
								
									
										13
									
								
								go.mod
								
								
								
								
							
							
						
						
									
										13
									
								
								go.mod
								
								
								
								
							|  | @ -1,15 +1,15 @@ | ||||||
| module github.com/unpoller/unpoller | module github.com/unpoller/unpoller | ||||||
| 
 | 
 | ||||||
| go 1.21 | go 1.23 | ||||||
| 
 | 
 | ||||||
| toolchain go1.22.1 | toolchain go1.23.1 | ||||||
| 
 | 
 | ||||||
| require ( | require ( | ||||||
| 	github.com/DataDog/datadog-go v4.8.3+incompatible | 	github.com/DataDog/datadog-go v4.8.3+incompatible | ||||||
| 	github.com/gorilla/mux v1.8.1 | 	github.com/gorilla/mux v1.8.1 | ||||||
| 	github.com/influxdata/influxdb1-client v0.0.0-20200827194710-b269163b24ab | 	github.com/influxdata/influxdb1-client v0.0.0-20200827194710-b269163b24ab | ||||||
| 	github.com/pkg/errors v0.9.1 | 	github.com/pkg/errors v0.9.1 | ||||||
| 	github.com/prometheus/client_golang v1.19.1 | 	github.com/prometheus/client_golang v1.20.3 | ||||||
| 	github.com/prometheus/common v0.55.0 | 	github.com/prometheus/common v0.55.0 | ||||||
| 	github.com/spf13/pflag v1.0.6-0.20201009195203-85dd5c8bc61c | 	github.com/spf13/pflag v1.0.6-0.20201009195203-85dd5c8bc61c | ||||||
| 	github.com/stretchr/testify v1.9.0 | 	github.com/stretchr/testify v1.9.0 | ||||||
|  | @ -21,13 +21,16 @@ require ( | ||||||
| 	golift.io/version v0.0.2 | 	golift.io/version v0.0.2 | ||||||
| ) | ) | ||||||
| 
 | 
 | ||||||
| require github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect | require ( | ||||||
|  | 	github.com/klauspost/compress v1.17.9 // indirect | ||||||
|  | 	github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect | ||||||
|  | ) | ||||||
| 
 | 
 | ||||||
| require ( | require ( | ||||||
| 	github.com/Microsoft/go-winio v0.6.0 // indirect | 	github.com/Microsoft/go-winio v0.6.0 // indirect | ||||||
| 	github.com/apapsch/go-jsonmerge/v2 v2.0.0 // indirect | 	github.com/apapsch/go-jsonmerge/v2 v2.0.0 // indirect | ||||||
| 	github.com/brianvoe/gofakeit/v6 v6.28.0 // indirect | 	github.com/brianvoe/gofakeit/v6 v6.28.0 // indirect | ||||||
| 	github.com/cespare/xxhash/v2 v2.2.0 // indirect | 	github.com/cespare/xxhash/v2 v2.3.0 // indirect | ||||||
| 	github.com/davecgh/go-spew v1.1.1 // indirect | 	github.com/davecgh/go-spew v1.1.1 // indirect | ||||||
| 	github.com/google/uuid v1.3.1 // indirect | 	github.com/google/uuid v1.3.1 // indirect | ||||||
| 	github.com/influxdata/line-protocol v0.0.0-20200327222509-2487e7298839 // indirect | 	github.com/influxdata/line-protocol v0.0.0-20200327222509-2487e7298839 // indirect | ||||||
|  |  | ||||||
							
								
								
									
										12
									
								
								go.sum
								
								
								
								
							
							
						
						
									
										12
									
								
								go.sum
								
								
								
								
							|  | @ -12,8 +12,8 @@ github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6r | ||||||
| github.com/bmatcuk/doublestar v1.1.1/go.mod h1:UD6OnuiIn0yFxxA2le/rnRU1G4RaI4UvFv1sNto9p6w= | github.com/bmatcuk/doublestar v1.1.1/go.mod h1:UD6OnuiIn0yFxxA2le/rnRU1G4RaI4UvFv1sNto9p6w= | ||||||
| github.com/brianvoe/gofakeit/v6 v6.28.0 h1:Xib46XXuQfmlLS2EXRuJpqcw8St6qSZz75OUo0tgAW4= | github.com/brianvoe/gofakeit/v6 v6.28.0 h1:Xib46XXuQfmlLS2EXRuJpqcw8St6qSZz75OUo0tgAW4= | ||||||
| github.com/brianvoe/gofakeit/v6 v6.28.0/go.mod h1:Xj58BMSnFqcn/fAQeSK+/PLtC5kSb7FJIq4JyGa8vEs= | github.com/brianvoe/gofakeit/v6 v6.28.0/go.mod h1:Xj58BMSnFqcn/fAQeSK+/PLtC5kSb7FJIq4JyGa8vEs= | ||||||
| github.com/cespare/xxhash/v2 v2.2.0 h1:DC2CZ1Ep5Y4k3ZQ899DldepgrayRUGE6BBZ/cd9Cj44= | github.com/cespare/xxhash/v2 v2.3.0 h1:UL815xU9SqsFlibzuggzjXhog7bL6oX9BbNZnL2UFvs= | ||||||
| github.com/cespare/xxhash/v2 v2.2.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= | github.com/cespare/xxhash/v2 v2.3.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= | ||||||
| github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= | github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= | ||||||
| github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= | github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= | ||||||
| github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= | github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= | ||||||
|  | @ -31,10 +31,14 @@ github.com/influxdata/influxdb1-client v0.0.0-20200827194710-b269163b24ab/go.mod | ||||||
| github.com/influxdata/line-protocol v0.0.0-20200327222509-2487e7298839 h1:W9WBk7wlPfJLvMCdtV4zPulc4uCPrlywQOmbFOhgQNU= | github.com/influxdata/line-protocol v0.0.0-20200327222509-2487e7298839 h1:W9WBk7wlPfJLvMCdtV4zPulc4uCPrlywQOmbFOhgQNU= | ||||||
| github.com/influxdata/line-protocol v0.0.0-20200327222509-2487e7298839/go.mod h1:xaLFMmpvUxqXtVkUJfg9QmT88cDaCJ3ZKgdZ78oO8Qo= | github.com/influxdata/line-protocol v0.0.0-20200327222509-2487e7298839/go.mod h1:xaLFMmpvUxqXtVkUJfg9QmT88cDaCJ3ZKgdZ78oO8Qo= | ||||||
| github.com/juju/gnuflag v0.0.0-20171113085948-2ce1bb71843d/go.mod h1:2PavIy+JPciBPrBUjwbNvtwB6RQlve+hkpll6QSNmOE= | github.com/juju/gnuflag v0.0.0-20171113085948-2ce1bb71843d/go.mod h1:2PavIy+JPciBPrBUjwbNvtwB6RQlve+hkpll6QSNmOE= | ||||||
|  | github.com/klauspost/compress v1.17.9 h1:6KIumPrER1LHsvBVuDa0r5xaG0Es51mhhB9BQB2qeMA= | ||||||
|  | github.com/klauspost/compress v1.17.9/go.mod h1:Di0epgTjJY877eYKx5yC51cX2A2Vl2ibi7bDH9ttBbw= | ||||||
| github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= | github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= | ||||||
| github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= | github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= | ||||||
| github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= | github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= | ||||||
| github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= | github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= | ||||||
|  | github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc= | ||||||
|  | github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw= | ||||||
| github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 h1:C3w9PqII01/Oq1c1nUAm88MOHcQC9l5mIlSMApZMrHA= | github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 h1:C3w9PqII01/Oq1c1nUAm88MOHcQC9l5mIlSMApZMrHA= | ||||||
| github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822/go.mod h1:+n7T8mK8HuQTcFwEeznm/DIxMOiR9yIdICNftLE1DvQ= | github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822/go.mod h1:+n7T8mK8HuQTcFwEeznm/DIxMOiR9yIdICNftLE1DvQ= | ||||||
| github.com/oapi-codegen/runtime v1.0.0 h1:P4rqFX5fMFWqRzY9M/3YF9+aPSPPB06IzP2P7oOxrWo= | github.com/oapi-codegen/runtime v1.0.0 h1:P4rqFX5fMFWqRzY9M/3YF9+aPSPPB06IzP2P7oOxrWo= | ||||||
|  | @ -43,8 +47,8 @@ github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= | ||||||
| github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= | github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= | ||||||
| github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= | github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= | ||||||
| github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= | github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= | ||||||
| github.com/prometheus/client_golang v1.19.1 h1:wZWJDwK+NameRJuPGDhlnFgx8e8HN3XHQeLaYJFJBOE= | github.com/prometheus/client_golang v1.20.3 h1:oPksm4K8B+Vt35tUhw6GbSNSgVlVSBH0qELP/7u83l4= | ||||||
| github.com/prometheus/client_golang v1.19.1/go.mod h1:mP78NwGzrVks5S2H6ab8+ZZGJLZUq1hoULYBAYBw1Ho= | github.com/prometheus/client_golang v1.20.3/go.mod h1:PIEt8X02hGcP8JWbeHyeZ53Y/jReSnHgO035n//V5WE= | ||||||
| github.com/prometheus/client_model v0.6.1 h1:ZKSh/rekM+n3CeS952MLRAdFwIKqeY8b62p8ais2e9E= | github.com/prometheus/client_model v0.6.1 h1:ZKSh/rekM+n3CeS952MLRAdFwIKqeY8b62p8ais2e9E= | ||||||
| github.com/prometheus/client_model v0.6.1/go.mod h1:OrxVMOVHjw3lKMa8+x6HeMGkHMQyHDk9E3jmP2AmGiY= | github.com/prometheus/client_model v0.6.1/go.mod h1:OrxVMOVHjw3lKMa8+x6HeMGkHMQyHDk9E3jmP2AmGiY= | ||||||
| github.com/prometheus/common v0.55.0 h1:KEi6DK7lXW/m7Ig5i47x0vRzuBsHuvJdi5ee6Y3G1dc= | github.com/prometheus/common v0.55.0 h1:KEi6DK7lXW/m7Ig5i47x0vRzuBsHuvJdi5ee6Y3G1dc= | ||||||
|  |  | ||||||
|  | @ -140,7 +140,7 @@ func (u *DatadogUnifi) setConfigDefaults() { | ||||||
| 		u.options = append(u.options, statsd.WithNamespace(*u.Namespace)) | 		u.options = append(u.options, statsd.WithNamespace(*u.Namespace)) | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	if u.Tags != nil && len(u.Tags) > 0 { | 	if len(u.Tags) > 0 { | ||||||
| 		u.options = append(u.options, statsd.WithTags(u.Tags)) | 		u.options = append(u.options, statsd.WithTags(u.Tags)) | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
|  | @ -378,7 +378,7 @@ func (u *DatadogUnifi) switchExport(r report, v any) { //nolint:cyclop | ||||||
| 	case *unifi.Event: | 	case *unifi.Event: | ||||||
| 		u.batchEvent(r, v) | 		u.batchEvent(r, v) | ||||||
| 	case *unifi.IDS: | 	case *unifi.IDS: | ||||||
| 		u.batchIDS(r, v) | 		u.batchIDs(r, v) | ||||||
| 	case *unifi.Alarm: | 	case *unifi.Alarm: | ||||||
| 		u.batchAlarms(r, v) | 		u.batchAlarms(r, v) | ||||||
| 	case *unifi.Anomaly: | 	case *unifi.Anomaly: | ||||||
|  |  | ||||||
|  | @ -11,11 +11,11 @@ import ( | ||||||
| // These constants are used as names for printed/logged counters.
 | // These constants are used as names for printed/logged counters.
 | ||||||
| const ( | const ( | ||||||
| 	eventT = item("Event") | 	eventT = item("Event") | ||||||
| 	idsT   = item("IDS") | 	idsT   = item("IDs") | ||||||
| ) | ) | ||||||
| 
 | 
 | ||||||
| // batchIDS generates intrusion detection datapoints for Datadog.
 | // batchIDs generates intrusion detection datapoints for Datadog.
 | ||||||
| func (u *DatadogUnifi) batchIDS(r report, i *unifi.IDS) { // nolint:dupl
 | func (u *DatadogUnifi) batchIDs(r report, i *unifi.IDS) { // nolint:dupl
 | ||||||
| 	if time.Since(i.Datetime) > u.Interval.Duration+time.Second { | 	if time.Since(i.Datetime) > u.Interval.Duration+time.Second { | ||||||
| 		return // The event is older than our interval, ignore it.
 | 		return // The event is older than our interval, ignore it.
 | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
|  | @ -9,11 +9,11 @@ import ( | ||||||
| // These constants are used as names for printed/logged counters.
 | // These constants are used as names for printed/logged counters.
 | ||||||
| const ( | const ( | ||||||
| 	eventT = item("Event") | 	eventT = item("Event") | ||||||
| 	idsT   = item("IDS") | 	idsT   = item("IDs") | ||||||
| ) | ) | ||||||
| 
 | 
 | ||||||
| // batchIDS generates intrusion detection datapoints for InfluxDB.
 | // batchIDs generates intrusion detection datapoints for InfluxDB.
 | ||||||
| func (u *InfluxUnifi) batchIDS(r report, i *unifi.IDS) { // nolint:dupl
 | func (u *InfluxUnifi) batchIDs(r report, i *unifi.IDS) { // nolint:dupl
 | ||||||
| 	if time.Since(i.Datetime) > u.Interval.Duration+time.Second { | 	if time.Since(i.Datetime) > u.Interval.Duration+time.Second { | ||||||
| 		return // The event is older than our interval, ignore it.
 | 		return // The event is older than our interval, ignore it.
 | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
|  | @ -452,7 +452,7 @@ func (u *InfluxUnifi) switchExport(r report, v any) { //nolint:cyclop | ||||||
| 	case *unifi.Event: | 	case *unifi.Event: | ||||||
| 		u.batchEvent(r, v) | 		u.batchEvent(r, v) | ||||||
| 	case *unifi.IDS: | 	case *unifi.IDS: | ||||||
| 		u.batchIDS(r, v) | 		u.batchIDs(r, v) | ||||||
| 	case *unifi.Alarm: | 	case *unifi.Alarm: | ||||||
| 		u.batchAlarms(r, v) | 		u.batchAlarms(r, v) | ||||||
| 	case *unifi.Anomaly: | 	case *unifi.Anomaly: | ||||||
|  |  | ||||||
|  | @ -34,7 +34,7 @@ func (u *InputUnifi) collectControllerEvents(c *Controller) ([]any, error) { | ||||||
| 
 | 
 | ||||||
| 	type caller func([]any, []*unifi.Site, *Controller) ([]any, error) | 	type caller func([]any, []*unifi.Site, *Controller) ([]any, error) | ||||||
| 
 | 
 | ||||||
| 	for _, call := range []caller{u.collectIDS, u.collectAnomalies, u.collectAlarms, u.collectEvents} { | 	for _, call := range []caller{u.collectIDs, u.collectAnomalies, u.collectAlarms, u.collectEvents} { | ||||||
| 		if newLogs, err = call(logs, sites, c); err != nil { | 		if newLogs, err = call(logs, sites, c); err != nil { | ||||||
| 			return logs, err | 			return logs, err | ||||||
| 		} | 		} | ||||||
|  | @ -123,9 +123,9 @@ func (u *InputUnifi) collectEvents(logs []any, sites []*unifi.Site, c *Controlle | ||||||
| 	return logs, nil | 	return logs, nil | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| func (u *InputUnifi) collectIDS(logs []any, sites []*unifi.Site, c *Controller) ([]any, error) { | func (u *InputUnifi) collectIDs(logs []any, sites []*unifi.Site, c *Controller) ([]any, error) { | ||||||
| 	if *c.SaveIDS { | 	if *c.SaveIDs { | ||||||
| 		u.LogDebugf("Collecting controller IDS data: %s (%s)", c.URL, c.ID) | 		u.LogDebugf("Collecting controller IDs data: %s (%s)", c.URL, c.ID) | ||||||
| 
 | 
 | ||||||
| 		for _, s := range sites { | 		for _, s := range sites { | ||||||
| 			events, err := c.Unifi.GetIDSSite(s) | 			events, err := c.Unifi.GetIDSSite(s) | ||||||
|  |  | ||||||
|  | @ -38,7 +38,7 @@ type Controller struct { | ||||||
| 	SaveAnomal *bool        `json:"save_anomalies" toml:"save_anomalies" xml:"save_anomalies" yaml:"save_anomalies"` | 	SaveAnomal *bool        `json:"save_anomalies" toml:"save_anomalies" xml:"save_anomalies" yaml:"save_anomalies"` | ||||||
| 	SaveAlarms *bool        `json:"save_alarms"    toml:"save_alarms"    xml:"save_alarms"    yaml:"save_alarms"` | 	SaveAlarms *bool        `json:"save_alarms"    toml:"save_alarms"    xml:"save_alarms"    yaml:"save_alarms"` | ||||||
| 	SaveEvents *bool        `json:"save_events"    toml:"save_events"    xml:"save_events"    yaml:"save_events"` | 	SaveEvents *bool        `json:"save_events"    toml:"save_events"    xml:"save_events"    yaml:"save_events"` | ||||||
| 	SaveIDS    *bool        `json:"save_ids"       toml:"save_ids"       xml:"save_ids"       yaml:"save_ids"` | 	SaveIDs    *bool        `json:"save_ids"       toml:"save_ids"       xml:"save_ids"       yaml:"save_ids"` | ||||||
| 	SaveDPI    *bool        `json:"save_dpi"       toml:"save_dpi"       xml:"save_dpi"       yaml:"save_dpi"` | 	SaveDPI    *bool        `json:"save_dpi"       toml:"save_dpi"       xml:"save_dpi"       yaml:"save_dpi"` | ||||||
| 	SaveRogue  *bool        `json:"save_rogue"     toml:"save_rogue"     xml:"save_rogue"     yaml:"save_rogue"` | 	SaveRogue  *bool        `json:"save_rogue"     toml:"save_rogue"     xml:"save_rogue"     yaml:"save_rogue"` | ||||||
| 	HashPII    *bool        `json:"hash_pii"       toml:"hash_pii"       xml:"hash_pii"       yaml:"hash_pii"` | 	HashPII    *bool        `json:"hash_pii"       toml:"hash_pii"       xml:"hash_pii"       yaml:"hash_pii"` | ||||||
|  | @ -231,8 +231,8 @@ func (u *InputUnifi) setDefaults(c *Controller) { //nolint:cyclop | ||||||
| 		c.SaveRogue = &f | 		c.SaveRogue = &f | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	if c.SaveIDS == nil { | 	if c.SaveIDs == nil { | ||||||
| 		c.SaveIDS = &f | 		c.SaveIDs = &f | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	if c.SaveEvents == nil { | 	if c.SaveEvents == nil { | ||||||
|  | @ -296,8 +296,8 @@ func (u *InputUnifi) setControllerDefaults(c *Controller) *Controller { //nolint | ||||||
| 		c.SaveDPI = u.Default.SaveDPI | 		c.SaveDPI = u.Default.SaveDPI | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	if c.SaveIDS == nil { | 	if c.SaveIDs == nil { | ||||||
| 		c.SaveIDS = u.Default.SaveIDS | 		c.SaveIDs = u.Default.SaveIDs | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	if c.SaveRogue == nil { | 	if c.SaveRogue == nil { | ||||||
|  |  | ||||||
|  | @ -127,12 +127,12 @@ func (u *InputUnifi) logController(c *Controller) { | ||||||
| 	u.Logf("   => Username: %s (has password: %v)", c.User, c.Pass != "") | 	u.Logf("   => Username: %s (has password: %v)", c.User, c.Pass != "") | ||||||
| 	u.Logf("   => Hash PII %v / Drop PII %v / Poll Sites: %s", *c.HashPII, *c.DropPII, strings.Join(c.Sites, ", ")) | 	u.Logf("   => Hash PII %v / Drop PII %v / Poll Sites: %s", *c.HashPII, *c.DropPII, strings.Join(c.Sites, ", ")) | ||||||
| 	u.Logf("   => Save Sites %v / Save DPI %v (metrics)", *c.SaveSites, *c.SaveDPI) | 	u.Logf("   => Save Sites %v / Save DPI %v (metrics)", *c.SaveSites, *c.SaveDPI) | ||||||
| 	u.Logf("   => Save Events %v / Save IDS %v (logs)", *c.SaveEvents, *c.SaveIDS) | 	u.Logf("   => Save Events %v / Save IDs %v (logs)", *c.SaveEvents, *c.SaveIDs) | ||||||
| 	u.Logf("   => Save Alarms %v / Anomalies %v (logs)", *c.SaveAlarms, *c.SaveAnomal) | 	u.Logf("   => Save Alarms %v / Anomalies %v (logs)", *c.SaveAlarms, *c.SaveAnomal) | ||||||
| 	u.Logf("   => Save Rogue APs: %v", *c.SaveRogue) | 	u.Logf("   => Save Rogue APs: %v", *c.SaveRogue) | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| // Events allows you to pull only events (and IDS) from the UniFi Controller.
 | // Events allows you to pull only events (and IDs) from the UniFi Controller.
 | ||||||
| // This does not fully respect HashPII, but it may in the future!
 | // This does not fully respect HashPII, but it may in the future!
 | ||||||
| // Use Filter.Path to pick a specific controller, otherwise poll them all!
 | // Use Filter.Path to pick a specific controller, otherwise poll them all!
 | ||||||
| func (u *InputUnifi) Events(filter *poller.Filter) (*poller.Events, error) { | func (u *InputUnifi) Events(filter *poller.Filter) (*poller.Events, error) { | ||||||
|  |  | ||||||
|  | @ -44,7 +44,7 @@ func formatControllers(controllers []*Controller) []*Controller { | ||||||
| 			SaveAlarms: c.SaveAlarms, | 			SaveAlarms: c.SaveAlarms, | ||||||
| 			SaveRogue:  c.SaveRogue, | 			SaveRogue:  c.SaveRogue, | ||||||
| 			SaveEvents: c.SaveEvents, | 			SaveEvents: c.SaveEvents, | ||||||
| 			SaveIDS:    c.SaveIDS, | 			SaveIDs:    c.SaveIDs, | ||||||
| 			SaveDPI:    c.SaveDPI, | 			SaveDPI:    c.SaveDPI, | ||||||
| 			HashPII:    c.HashPII, | 			HashPII:    c.HashPII, | ||||||
| 			DropPII:    c.DropPII, | 			DropPII:    c.DropPII, | ||||||
|  |  | ||||||
|  | @ -48,7 +48,7 @@ func (r *Report) ProcessEventLogs(events *poller.Events) *Logs { | ||||||
| 	for _, e := range events.Logs { | 	for _, e := range events.Logs { | ||||||
| 		switch event := e.(type) { | 		switch event := e.(type) { | ||||||
| 		case *unifi.IDS: | 		case *unifi.IDS: | ||||||
| 			r.IDS(event, logs) | 			r.IDs(event, logs) | ||||||
| 		case *unifi.Event: | 		case *unifi.Event: | ||||||
| 			r.Event(event, logs) | 			r.Event(event, logs) | ||||||
| 		case *unifi.Alarm: | 		case *unifi.Alarm: | ||||||
|  | @ -65,7 +65,7 @@ func (r *Report) ProcessEventLogs(events *poller.Events) *Logs { | ||||||
| 
 | 
 | ||||||
| func (r *Report) String() string { | func (r *Report) String() string { | ||||||
| 	return fmt.Sprintf("%s: %d, %s: %d, %s: %d, %s: %d, Dur: %v", | 	return fmt.Sprintf("%s: %d, %s: %d, %s: %d, %s: %d, Dur: %v", | ||||||
| 		typeEvent, r.Counts[typeEvent], typeIDS, r.Counts[typeIDS], | 		typeEvent, r.Counts[typeEvent], typeIDs, r.Counts[typeIDs], | ||||||
| 		typeAlarm, r.Counts[typeAlarm], typeAnomaly, r.Counts[typeAnomaly], | 		typeAlarm, r.Counts[typeAlarm], typeAnomaly, r.Counts[typeAnomaly], | ||||||
| 		time.Since(r.Start).Round(time.Millisecond)) | 		time.Since(r.Start).Round(time.Millisecond)) | ||||||
| } | } | ||||||
|  |  | ||||||
|  | @ -6,15 +6,15 @@ import ( | ||||||
| 	"github.com/unpoller/unifi" | 	"github.com/unpoller/unifi" | ||||||
| ) | ) | ||||||
| 
 | 
 | ||||||
| const typeIDS = "IDS" | const typeIDs = "IDs" | ||||||
| 
 | 
 | ||||||
| // event stores a structured event Event for batch sending to Loki.
 | // event stores a structured event Event for batch sending to Loki.
 | ||||||
| func (r *Report) IDS(event *unifi.IDS, logs *Logs) { | func (r *Report) IDs(event *unifi.IDS, logs *Logs) { | ||||||
| 	if event.Datetime.Before(r.Oldest) { | 	if event.Datetime.Before(r.Oldest) { | ||||||
| 		return | 		return | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	r.Counts[typeIDS]++ // increase counter and append new log line.
 | 	r.Counts[typeIDs]++ // increase counter and append new log line.
 | ||||||
| 
 | 
 | ||||||
| 	logs.Streams = append(logs.Streams, LogStream{ | 	logs.Streams = append(logs.Streams, LogStream{ | ||||||
| 		Entries: [][]string{{strconv.FormatInt(event.Datetime.UnixNano(), 10), event.Msg}}, | 		Entries: [][]string{{strconv.FormatInt(event.Datetime.UnixNano(), 10), event.Msg}}, | ||||||
|  |  | ||||||
|  | @ -24,7 +24,7 @@ func NewTestSetup(t *testing.T) *TestRig { | ||||||
| 		SaveAnomal: &enabled, | 		SaveAnomal: &enabled, | ||||||
| 		SaveAlarms: &enabled, | 		SaveAlarms: &enabled, | ||||||
| 		SaveEvents: &enabled, | 		SaveEvents: &enabled, | ||||||
| 		SaveIDS:    &enabled, | 		SaveIDs:    &enabled, | ||||||
| 		SaveDPI:    &enabled, | 		SaveDPI:    &enabled, | ||||||
| 		SaveRogue:  &enabled, | 		SaveRogue:  &enabled, | ||||||
| 		SaveSites:  &enabled, | 		SaveSites:  &enabled, | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue