Skip to content

Commit

Permalink
[AI-4929] [LOI-381] Add logs for octopus_deploy (#19543)
Browse files Browse the repository at this point in the history
* 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 <[email protected]>

* update source in config

* add changelog

* fix changelog

---------

Co-authored-by: Thibault Krebs <[email protected]>
  • Loading branch information
sarah-witt and thibaultkrebs authored Feb 21, 2025
1 parent 2468ca5 commit 679238b
Show file tree
Hide file tree
Showing 7 changed files with 169 additions and 2 deletions.
41 changes: 41 additions & 0 deletions octopus_deploy/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion octopus_deploy/assets/configuration/spec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -274,5 +274,5 @@ files:
- template: logs
example:
- type: integration
source: octopus-deploy
source: octopus_deploy
service: <SERVICE_NAME>
51 changes: 51 additions & 0 deletions octopus_deploy/assets/logs/octopus_deploy.yaml
Original file line number Diff line number Diff line change
@@ -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 "<anonymous>"
- >
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
71 changes: 71 additions & 0 deletions octopus_deploy/assets/logs/octopus_deploy_tests.yaml
Original file line number Diff line number Diff line change
@@ -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 \"<anonymous>\""
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 \"<anonymous>\""
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
1 change: 1 addition & 0 deletions octopus_deploy/changelog.d/19543.fixed
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Update logs configuration example.
Original file line number Diff line number Diff line change
Expand Up @@ -582,5 +582,5 @@ instances:
#
# logs:
# - type: integration
# source: octopus-deploy
# source: octopus_deploy
# service: <SERVICE_NAME>
3 changes: 3 additions & 0 deletions octopus_deploy/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,9 @@
},
"monitors": {
"Deployment Failed": "assets/monitors/deployment_failed.json"
},
"logs": {
"source": "octopus_deploy"
}
},
"author": {
Expand Down

0 comments on commit 679238b

Please sign in to comment.