From ae3669e220dc29d5c6a4fa82413bd30a377e1eee Mon Sep 17 00:00:00 2001 From: Naomi Pentrel <5212232+npentrel@users.noreply.github.com> Date: Thu, 16 Jan 2025 15:24:19 +0100 Subject: [PATCH 1/3] DOCS-3366: Deduplicate noisy logs --- docs/manage/troubleshoot/troubleshoot.md | 4 ++++ docs/operate/reference/viam-server/_index.md | 11 +++++++++++ 2 files changed, 15 insertions(+) diff --git a/docs/manage/troubleshoot/troubleshoot.md b/docs/manage/troubleshoot/troubleshoot.md index 747dfd5e6b..053de4d795 100644 --- a/docs/manage/troubleshoot/troubleshoot.md +++ b/docs/manage/troubleshoot/troubleshoot.md @@ -62,6 +62,10 @@ For example: For more information on setting log levels see, [Logging](/manage/troubleshoot/troubleshoot/#check-logs). +You may also find that not all logs you are expecting are displayed. +By default, `viam-server` deduplicates log messages that are deemed noisy. +To disable this behavior, see [Disable log deduplication](/operate/reference/viam-server/). + To access logs from the commandline, use [`viam machines logs`](/dev/tools/cli/#machines-alias-robots) on the command line or the [Machines API](/dev/reference/apis/robot/). ## Remote shell on the machine diff --git a/docs/operate/reference/viam-server/_index.md b/docs/operate/reference/viam-server/_index.md index c01ad69590..c38891a551 100644 --- a/docs/operate/reference/viam-server/_index.md +++ b/docs/operate/reference/viam-server/_index.md @@ -144,6 +144,17 @@ Patterns are processed from top to bottom. If multiple patterns apply, the last pattern to be processed will apply. If log configurations are applied at a resource level using the `log_configuration` field, these take precedence over log levels applied in the `log` field of the machine configuration. +#### Disable log deduplication + +By default, `viam-server` deduplicates log messages that are deemed noisy. +A log is deemed noisy if it has been output 3 times in the past 10 seconds. + +To disable log deduplication, set `disable_log_deduplication` in your machine's configuration: + +```json +"disable_log_deduplication": true +``` + #### Debugging You can enable debug level logs in two ways: From d71f14c8cb6a5f9aa1b91d2b21a3812f65afe3d2 Mon Sep 17 00:00:00 2001 From: Naomi Pentrel <5212232+npentrel@users.noreply.github.com> Date: Mon, 20 Jan 2025 13:38:32 +0100 Subject: [PATCH 2/3] Add full config examples --- docs/operate/reference/viam-server/_index.md | 42 ++++++++++++++++++++ 1 file changed, 42 insertions(+) diff --git a/docs/operate/reference/viam-server/_index.md b/docs/operate/reference/viam-server/_index.md index c38891a551..8533d83c44 100644 --- a/docs/operate/reference/viam-server/_index.md +++ b/docs/operate/reference/viam-server/_index.md @@ -144,6 +144,31 @@ Patterns are processed from top to bottom. If multiple patterns apply, the last pattern to be processed will apply. If log configurations are applied at a resource level using the `log_configuration` field, these take precedence over log levels applied in the `log` field of the machine configuration. +{{% expand "Click to view full configuration example" %}} + +```json {class="line-numbers linkable-line-numbers" data-line="10-18"} +{ + "components": [ + { + "name": "camera1", + "type": "camera", + "model": "fake" + } + ], + "services": [], + "log": [ +     { +       "pattern": "rdk.resource_manager", +       "level": "info", +     },{ +       "pattern": "rdk.resource_manager.*", +       "level": "debug", +     } +  ] +} +``` +{{% /expand%}} + #### Disable log deduplication By default, `viam-server` deduplicates log messages that are deemed noisy. @@ -155,6 +180,23 @@ To disable log deduplication, set `disable_log_deduplication` in your machine's "disable_log_deduplication": true ``` +{{% expand "Click to view full configuration example" %}} + +```json {class="line-numbers linkable-line-numbers" data-line="10"} +{ + "components": [ + { + "name": "camera1", + "type": "camera", + "model": "fake" + } + ], + "services": [], + "disable_log_deduplication": true +} +``` +{{% /expand%}} + #### Debugging You can enable debug level logs in two ways: From 3386806d8e38be387128e18fe0230b1a9f51e461 Mon Sep 17 00:00:00 2001 From: Naomi Pentrel <5212232+npentrel@users.noreply.github.com> Date: Mon, 20 Jan 2025 15:34:21 +0100 Subject: [PATCH 3/3] lint --- docs/operate/reference/viam-server/_index.md | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/docs/operate/reference/viam-server/_index.md b/docs/operate/reference/viam-server/_index.md index 8533d83c44..8224b15f55 100644 --- a/docs/operate/reference/viam-server/_index.md +++ b/docs/operate/reference/viam-server/_index.md @@ -157,16 +157,18 @@ If log configurations are applied at a resource level using the `log_configurati ], "services": [], "log": [ -     { -       "pattern": "rdk.resource_manager", -       "level": "info", -     },{ -       "pattern": "rdk.resource_manager.*", -       "level": "debug", -     } -  ] + { + "pattern": "rdk.resource_manager", + "level": "info" + }, + { + "pattern": "rdk.resource_manager.*", + "level": "debug" + } + ] } ``` + {{% /expand%}} #### Disable log deduplication @@ -195,6 +197,7 @@ To disable log deduplication, set `disable_log_deduplication` in your machine's "disable_log_deduplication": true } ``` + {{% /expand%}} #### Debugging