From 679238b4b5850166ae6d2685d1527d7888102d02 Mon Sep 17 00:00:00 2001 From: Sarah Witt Date: Fri, 21 Feb 2025 14:51:04 -0500 Subject: [PATCH] [AI-4929] [LOI-381] Add logs for octopus_deploy (#19543) * Add logs * fix integration id and name * update tests and readme * fix timestamp and update readme * fix timestamp * Update octopus_deploy/assets/logs/octopus_deploy.yaml Co-authored-by: Thibault Krebs <150821137+thibaultkrebs@users.noreply.github.com> * update source in config * add changelog * fix changelog --------- Co-authored-by: Thibault Krebs <150821137+thibaultkrebs@users.noreply.github.com> --- octopus_deploy/README.md | 41 +++++++++++ octopus_deploy/assets/configuration/spec.yaml | 2 +- .../assets/logs/octopus_deploy.yaml | 51 +++++++++++++ .../assets/logs/octopus_deploy_tests.yaml | 71 +++++++++++++++++++ octopus_deploy/changelog.d/19543.fixed | 1 + .../octopus_deploy/data/conf.yaml.example | 2 +- octopus_deploy/manifest.json | 3 + 7 files changed, 169 insertions(+), 2 deletions(-) create mode 100644 octopus_deploy/assets/logs/octopus_deploy.yaml create mode 100644 octopus_deploy/assets/logs/octopus_deploy_tests.yaml create mode 100644 octopus_deploy/changelog.d/19543.fixed diff --git a/octopus_deploy/README.md b/octopus_deploy/README.md index e68af92b09544..26da8cf0ac607 100644 --- a/octopus_deploy/README.md +++ b/octopus_deploy/README.md @@ -30,6 +30,47 @@ No additional installation is needed on your server. 3. [Restart the Agent][5]. +#### Logs + +The Octopus deploy integration collects two types of logs: deployment logs and server logs. + +##### Collecting Deployment Logs + +Deployment logs are gathered from deployment tasks, useful for debugging failed deployments. To collect deployment logs, complete the following steps: + +1. Collecting logs is disabled by default in the Datadog Agent. Enable it in your `datadog.yaml` file: + + ```yaml + logs_enabled: true + ``` + +2. Uncomment and edit the logs configuration block in your `octopus_deploy.d/conf.yaml` file. Here's an example: + + ```yaml + logs: + - type: integration + source: octopus_deploy + ``` + +##### Collecting Server Logs + +Server logs are diagnostic information from the Octopus Server itself. They can only be collected when the Datadog Agent is running on same machine as the Octopus Server. To collect server logs, complete the following steps: + +1. Collecting logs is disabled by default in the Datadog Agent. Enable it in your `datadog.yaml` file: + + ```yaml + logs_enabled: true + ``` + +2. Uncomment and edit the logs configuration block in your `octopus_deploy.d/conf.yaml` file. Here's an example: + + ```yaml + logs: + - type: file + path: /OctopusServer/Server/Logs/OctopusServer.txt + source: octopus_deploy + ``` + ### Validation [Run the Agent's status subcommand][6] and look for `octopus_deploy` under the Checks section. diff --git a/octopus_deploy/assets/configuration/spec.yaml b/octopus_deploy/assets/configuration/spec.yaml index 2cbecd7c66448..7a0f3d1b6c3b9 100644 --- a/octopus_deploy/assets/configuration/spec.yaml +++ b/octopus_deploy/assets/configuration/spec.yaml @@ -274,5 +274,5 @@ files: - template: logs example: - type: integration - source: octopus-deploy + source: octopus_deploy service: diff --git a/octopus_deploy/assets/logs/octopus_deploy.yaml b/octopus_deploy/assets/logs/octopus_deploy.yaml new file mode 100644 index 0000000000000..8382ef73d5b40 --- /dev/null +++ b/octopus_deploy/assets/logs/octopus_deploy.yaml @@ -0,0 +1,51 @@ +id: octopus_deploy +metric_id: octopus-deploy +backend_only: false +facets: [] +pipeline: + type: pipeline + name: "Octopus Deploy" + enabled: true + filter: + query: source:octopus_deploy + processors: + - type: grok-parser + name: Octopus Parser + enabled: true + source: message + samples: + - > + 2024-08-23 18:47:15.8732 7 1 INFO Octopus.Server version + 2024.2.9409 (2024.2.9409) instance OctopusServer + - 2024-08-23 18:47:24.0518 7 1 INFO Defaulting server node + name to '"08c3dfcac5a3"'. + - > + 2025-01-29 21:32:16.7923 1 75 INFO "HTTP" "GET" to + "localhost:8080""/api/octopusservernodes/ping" "completed" with 200 in + 00:00:00.0224869 (22ms) by "" + - > + 2025-01-28 19:34:47.9679 1 111 ERROR Executing task "Check + target health for Default Machine Policy" "abandoned" after 290ms. + - > + 2025-01-27 21:00:40.7777 1 101 WARN Ignoring incompatible + step package "kustomize 1.0.12": "kustomize step package is + deprecated" + grok: + supportRules: "" + matchRules: octopus_default %{date("yyyy-MM-DD + HH:mm:ss.SSSS"):timestamp}\s+%{number:tid}\s+%{number:pid}\s+%{word:level}\s+%{data:message} + - type: message-remapper + name: Define `message` as the official message of the log + enabled: true + sources: + - message + - type: status-remapper + name: Define `level` as the official status of the log + enabled: true + sources: + - level + - type: date-remapper + name: Define `timestamp` as the official date of the log + enabled: true + sources: + - timestamp diff --git a/octopus_deploy/assets/logs/octopus_deploy_tests.yaml b/octopus_deploy/assets/logs/octopus_deploy_tests.yaml new file mode 100644 index 0000000000000..d91ea2c497f74 --- /dev/null +++ b/octopus_deploy/assets/logs/octopus_deploy_tests.yaml @@ -0,0 +1,71 @@ +id: "octopus_deploy" +tests: + - + sample: |- + 2025-01-28 18:47:24.0518 7 1 INFO Defaulting server node + name to '"08c3dfcac5a3"'. + result: + custom: + level: "INFO" + pid: 1.0 + tid: 7.0 + timestamp: 1738090044051 + message: |- + Defaulting server node + name to '"08c3dfcac5a3"'. + status: "info" + tags: + - "source:LOGS_SOURCE" + timestamp: 1738090044051 + - + sample: "2025-01-28 18:47:15.8732 7 1 INFO Octopus.Server version 2024.2.9409 (2024.2.9409) instance OctopusServer" + result: + custom: + level: "INFO" + pid: 1.0 + tid: 7.0 + timestamp: 1738090035873 + message: "Octopus.Server version 2024.2.9409 (2024.2.9409) instance OctopusServer" + status: "info" + tags: + - "source:LOGS_SOURCE" + timestamp: 1738090035873 + - + sample: "2025-01-29 21:32:16.7923 1 75 INFO \"HTTP\" \"GET\" to \"localhost:8080\"\"/api/octopusservernodes/ping\" \"completed\" with 200 in 00:00:00.0224869 (22ms) by \"\"" + result: + custom: + level: "INFO" + pid: 75.0 + tid: 1.0 + timestamp: 1738186336792 + message: "\"HTTP\" \"GET\" to \"localhost:8080\"\"/api/octopusservernodes/ping\" \"completed\" with 200 in 00:00:00.0224869 (22ms) by \"\"" + status: "info" + tags: + - "source:LOGS_SOURCE" + timestamp: 1738186336792 + - + sample: "2025-01-28 19:34:47.9679 1 111 ERROR Executing task \"Check target health for Default Machine Policy\" \"abandoned\" after 290ms." + result: + custom: + level: "ERROR" + pid: 111.0 + tid: 1.0 + timestamp: 1738092887967 + message: "Executing task \"Check target health for Default Machine Policy\" \"abandoned\" after 290ms." + status: "error" + tags: + - "source:LOGS_SOURCE" + timestamp: 1738092887967 + - + sample: "2025-01-27 21:00:40.7777 1 101 WARN Ignoring incompatible step package \"kustomize 1.0.12\": \"kustomize step package is deprecated\"" + result: + custom: + level: "WARN" + pid: 101.0 + tid: 1.0 + timestamp: 1738011640777 + message: "Ignoring incompatible step package \"kustomize 1.0.12\": \"kustomize step package is deprecated\"" + status: "warn" + tags: + - "source:LOGS_SOURCE" + timestamp: 1738011640777 \ No newline at end of file diff --git a/octopus_deploy/changelog.d/19543.fixed b/octopus_deploy/changelog.d/19543.fixed new file mode 100644 index 0000000000000..04ef7c680c140 --- /dev/null +++ b/octopus_deploy/changelog.d/19543.fixed @@ -0,0 +1 @@ +Update logs configuration example. \ No newline at end of file diff --git a/octopus_deploy/datadog_checks/octopus_deploy/data/conf.yaml.example b/octopus_deploy/datadog_checks/octopus_deploy/data/conf.yaml.example index 05c1607b0821a..6f6d1eee25fb9 100644 --- a/octopus_deploy/datadog_checks/octopus_deploy/data/conf.yaml.example +++ b/octopus_deploy/datadog_checks/octopus_deploy/data/conf.yaml.example @@ -582,5 +582,5 @@ instances: # # logs: # - type: integration -# source: octopus-deploy +# source: octopus_deploy # service: diff --git a/octopus_deploy/manifest.json b/octopus_deploy/manifest.json index 9c4649ede9015..9f6653667a90e 100644 --- a/octopus_deploy/manifest.json +++ b/octopus_deploy/manifest.json @@ -47,6 +47,9 @@ }, "monitors": { "Deployment Failed": "assets/monitors/deployment_failed.json" + }, + "logs": { + "source": "octopus_deploy" } }, "author": {