Skip to content

Commit

Permalink
Merge pull request #661 from typeid/maint_logsa-Cmd
Browse files Browse the repository at this point in the history
Maint: update dt logs command examples
  • Loading branch information
openshift-merge-bot[bot] authored Feb 13, 2025
2 parents 9bef5e7 + 9220780 commit 9e072fa
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 12 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -332,17 +332,17 @@ osdctl cluster break-glass cleanup <cluster identifier>
### Cluster Dynatrace
#### Fetch logs from Dynatrace
```bash
osdctl cluster dynatrace logs
osdctl dt logs
```

#### Gather all Pod logs and Application event from HCP
```bash
osdctl cluster dynatrace gather-logs <cluster-id>
osdctl dt gather-logs <cluster-id>
```

#### Get Dynatrace Tenant URL for given MC or HCP cluster
```bash
osdctl cluster dynatrace url <cluster-id>
osdctl dt url <cluster-id>
```

### Send a servicelog to a cluster
Expand Down
2 changes: 1 addition & 1 deletion cmd/dynatrace/hcpGatherLogsCmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ func NewCmdHCPMustGather() *cobra.Command {
`,
Example: `
# Gather logs for a HCP cluster with cluster id hcp-cluster-id-123
osdctl cluster dynatrace gather-logs hcp-cluster-id-123`,
osdctl dt gather-logs hcp-cluster-id-123`,
Args: cobra.ExactArgs(1),
DisableAutoGenTag: true,
Run: func(cmd *cobra.Command, args []string) {
Expand Down
22 changes: 14 additions & 8 deletions cmd/dynatrace/logsCmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,20 +34,26 @@ const (
`

logsCmdExample = `
# Get the logs of HCP cluster in current cluster context.
$ osdctl cluster dynatrace logs
# Get the logs of the cluster in the current context.
$ osdctl dt logs
# Get the logs of a specific HCP cluster
$ osdctl cluster dynatrace logs --cluster <cluster-id>
# Get the logs of a specific cluster
$ osdctl dt logs --cluster <cluster-id>
# Get the logs of the pod alertmanager-main-0 in namespace openshift-monitoring
$ osdctl cluster dynatrace logs --po alertmanager-main-0 --namespace openshift-monitoring
# Get a link to the dynatrace UI for the current cluster context.
$ osdctl dt logs --console
# Get the logs of the pod alertmanager-main-0 in namespace openshift-monitoring in the current cluster context.
$ osdctl dt logs alertmanager-main-0 -n openshift-monitoring
# Get the logs of the pod alertmanager-main-0 in namespace openshift-monitoring for a specific HCP cluster
$ osdctl dt logs alertmanager-main-0 -n openshift-monitoring --cluster <cluster-id>
# Only return logs newer than 2 hours old (an integer in hours)
$ osdctl cluster dynatrace logs --since 2
$ osdctl dt logs alertmanager-main-0 -n openshift-monitoring --since 2
# Restrict return of logs to those that contain a specific phrase
$ osdctl cluster dynatrace logs --contains <phrase>
$ osdctl dt logs alertmanager-main-0 -n openshift-monitoring --contains <phrase>
`
)

Expand Down

0 comments on commit 9e072fa

Please sign in to comment.