Skip to content

Commit

Permalink
Add example and description for the dynatrace command (#605)
Browse files Browse the repository at this point in the history
* Add example and description for the dynatrace command

* format long description and examples
  • Loading branch information
feichashao authored Aug 29, 2024
1 parent 2f187f3 commit f067e16
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 5 deletions.
14 changes: 11 additions & 3 deletions cmd/cluster/dynatrace/hcpGatherLogsCmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,17 @@ import (

func NewCmdHCPMustGather() *cobra.Command {
hcpMgCmd := &cobra.Command{
Use: "gather-logs <cluster-id>",
Aliases: []string{"gl"},
Short: "Gather all Pod logs and Application event from HCP",
Use: "gather-logs <cluster-id>",
Aliases: []string{"gl"},
Short: "Gather all Pod logs and Application event from HCP",
Long: `Gathers pods logs and evnets of a given HCP from Dynatrace.
This command fetches the logs from the HCP namespace, the hypershift namespace and cert-manager related namespaces.
Logs will be dumped to a directory with prefix hcp-must-gather.
`,
Example: `
# Gather logs for a HCP cluster with cluster id hcp-cluster-id-123
osdctl cluster dynatrace gather-logs hcp-cluster-id-123`,
Args: cobra.ExactArgs(1),
DisableAutoGenTag: true,
Run: func(cmd *cobra.Command, args []string) {
Expand Down
11 changes: 9 additions & 2 deletions cmd/cluster/dynatrace/logsCmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,15 @@ var (

func NewCmdLogs() *cobra.Command {
logsCmd := &cobra.Command{
Use: "logs <cluster-id>",
Short: "Fetch logs from Dynatrace",
Use: "logs <cluster-id>",
Short: "Fetch logs from Dynatrace",
Long: `Fetch logs from Dynatrace and display the logs like oc logs.
This command also prints the Dynatrace URL and the corresponding DQL in the output.`,
Example: `
# Get the logs of HCP cluster hcp-cluster-id-123.
# Specify to get the logs of the pod alertmanager-main-0 in namespace openshift-monitoring
osdctl cluster dynatrace logs hcp-cluster-id-123 --namespace openshift-monitoring --pod alertmanager-main-0`,
Args: cobra.ExactArgs(1),
DisableAutoGenTag: true,
Run: func(cmd *cobra.Command, args []string) {
Expand Down

0 comments on commit f067e16

Please sign in to comment.