You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: cmd/cluster/dynatrace/logsCmd.go
+5-9Lines changed: 5 additions & 9 deletions
Original file line number
Diff line number
Diff line change
@@ -25,26 +25,22 @@ var (
25
25
26
26
funcNewCmdLogs() *cobra.Command {
27
27
logsCmd:=&cobra.Command{
28
-
Use: "logs",
28
+
Use: "logs <cluster-id>",
29
29
Short: "Fetch logs from Dynatrace",
30
-
Args: cobra.NoArgs,
30
+
Args: cobra.ExactArgs(1),
31
31
DisableAutoGenTag: true,
32
32
Run: func(cmd*cobra.Command, args []string) {
33
-
err:=main()
33
+
err:=main(args[0])
34
34
iferr!=nil {
35
35
cmdutil.CheckErr(err)
36
36
}
37
37
},
38
38
}
39
39
40
-
// set cluster flag as required
41
-
logsCmd.MarkFlagRequired("cluster")
42
-
43
40
logsCmd.Flags().BoolVar(&dryRun, "dry-run", false, "Only builds the query without fetching any logs from the tenant")
44
41
logsCmd.Flags().IntVar(&tail, "tail", 100, "Last 'n' logs to fetch (defaults to 100)")
45
42
logsCmd.Flags().IntVar(&since, "since", 1, "Number of hours (integer) since which to search (defaults to 1 hour)")
46
43
logsCmd.Flags().StringVar(&contains, "contains", "", "Include logs which contain a phrase")
47
-
logsCmd.Flags().StringVar(&cluster, "cluster", "", "Cluster identifier (name / internal ID / external ID) to search")
48
44
logsCmd.Flags().StringVar(&sortOrder, "sort", "desc", "Sort the results by timestamp in either ascending or descending order. Accepted values are 'asc' and 'desc'")
49
45
logsCmd.Flags().BoolVar(&hcp, "hcp", false, "Set true to Include the HCP Namespace")
returnfmt.Sprintf("\nLink to Web Console - \n%sui/apps/dynatrace.classic.logs.events/ui/logs-events?gtf=-%dh&gf=all&sortDirection=desc&advancedQueryMode=true&isDefaultQuery=false&visualizationType=table#%s\n\n", dtURL, since, base64Url)
0 commit comments