diff --git a/examples/remote_api_example.conf b/examples/remote_api_example.conf index 4673de17..149bb204 100644 --- a/examples/remote_api_example.conf +++ b/examples/remote_api_example.conf @@ -7,6 +7,10 @@ [poller] debug = false quiet = false +# log_unknown_types = false # Set to true to log unknown device types as DEBUG messages. + # By default, newer UniFi device types that aren't recognized + # are silently ignored to reduce log volume. Enable this when + # debugging or reporting new device types to developers. [unifi] remote = true diff --git a/examples/remote_api_example.yaml b/examples/remote_api_example.yaml index 00ed1b00..3f8982ac 100644 --- a/examples/remote_api_example.yaml +++ b/examples/remote_api_example.yaml @@ -7,6 +7,10 @@ poller: debug: false quiet: false + # log_unknown_types: false # Set to true to log unknown device types as DEBUG messages. + # By default, newer UniFi device types that aren't recognized + # are silently ignored to reduce log volume. Enable this when + # debugging or reporting new device types to developers. unifi: # Enable remote API mode - automatically discovers all consoles diff --git a/examples/up.conf.example b/examples/up.conf.example index 898416ce..24394482 100644 --- a/examples/up.conf.example +++ b/examples/up.conf.example @@ -11,6 +11,11 @@ # Recommend enabling debug with this setting for better error logging. quiet = false + # Log unknown device types as DEBUG messages. By default (false), newer UniFi + # device types that aren't recognized are silently ignored to reduce log volume. + # Enable this when debugging or reporting new device types to developers. + # log_unknown_types = false + # Load dynamic plugins. Advanced use; only sample mysql plugin provided by default. plugins = [] diff --git a/examples/up.json.example b/examples/up.json.example index d43bb14e..85438477 100644 --- a/examples/up.json.example +++ b/examples/up.json.example @@ -2,7 +2,8 @@ "poller": { "debug": false, "quiet": false, - "plugins": [] + "plugins": [], + "log_unknown_types": false }, "prometheus": { diff --git a/examples/up.yaml.example b/examples/up.yaml.example index 213e21c4..616939b2 100644 --- a/examples/up.yaml.example +++ b/examples/up.yaml.example @@ -9,6 +9,10 @@ poller: debug: false quiet: false plugins: [] + # log_unknown_types: false # Set to true to log unknown device types as DEBUG messages. + # By default, newer UniFi device types that aren't recognized + # are silently ignored to reduce log volume. Enable this when + # debugging or reporting new device types to developers. prometheus: disable: false diff --git a/pkg/influxunifi/influxdb.go b/pkg/influxunifi/influxdb.go index 82153818..d5c4c2a5 100644 --- a/pkg/influxunifi/influxdb.go +++ b/pkg/influxunifi/influxdb.go @@ -467,6 +467,8 @@ func (u *InfluxUnifi) switchExport(r report, v any) { //nolint:cyclop case *unifi.SpeedTestResult: u.batchSpeedTest(r, v) default: - u.LogErrorf("invalid export type: %T", v) + if u.Collector.Poller().LogUnknownTypes { + u.LogDebugf("unknown export type: %T", v) + } } } diff --git a/pkg/poller/config.go b/pkg/poller/config.go index f520ab5a..f7caf535 100644 --- a/pkg/poller/config.go +++ b/pkg/poller/config.go @@ -102,9 +102,10 @@ type Config struct { // Poller is the global config values. type Poller struct { - Plugins []string `json:"plugins" toml:"plugins" xml:"plugin" yaml:"plugins"` - Debug bool `json:"debug" toml:"debug" xml:"debug,attr" yaml:"debug"` - Quiet bool `json:"quiet" toml:"quiet" xml:"quiet,attr" yaml:"quiet"` + Plugins []string `json:"plugins" toml:"plugins" xml:"plugin" yaml:"plugins"` + Debug bool `json:"debug" toml:"debug" xml:"debug,attr" yaml:"debug"` + Quiet bool `json:"quiet" toml:"quiet" xml:"quiet,attr" yaml:"quiet"` + LogUnknownTypes bool `json:"log_unknown_types" toml:"log_unknown_types" xml:"log_unknown_types" yaml:"log_unknown_types"` } // LoadPlugins reads-in dynamic shared libraries. diff --git a/pkg/promunifi/collector.go b/pkg/promunifi/collector.go index a4f310d0..7d0934de 100644 --- a/pkg/promunifi/collector.go +++ b/pkg/promunifi/collector.go @@ -452,6 +452,8 @@ func (u *promUnifi) switchExport(r report, v any) { case *unifi.UsageByCountry: u.exportCountryTraffic(r, v) default: - u.LogErrorf("invalid type: %T", v) + if u.Collector.Poller().LogUnknownTypes { + u.LogDebugf("unknown type: %T", v) + } } }