Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var GetCommand = &cobra.Command{ Use: "get <log group>", Short: "Get log events", Long: "", Args: func(cmd *cobra.Command, args []string) error { if len(args) < 1 { return errors.New("getting events requires log group argument") } return nil }, Run: func(cmd *cobra.Command, args []string) { getConfig.Group = args[0] b := blade.NewBlade(&getConfig, &awsConfig, nil) if getConfig.Prefix != "" { streams := b.GetLogStreams() if len(streams) == 0 { fmt.Printf("No streams found in %s with prefix %s\n", getConfig.Group, getConfig.Prefix) fmt.Printf("To view available streams: `saw streams %s`\n", getConfig.Group) os.Exit(3) } getConfig.Streams = streams } b.GetEvents() }, }
View Source
var GroupsCommand = &cobra.Command{ Use: "groups", Short: "List log groups", Long: "", Run: func(cmd *cobra.Command, args []string) { b := blade.NewBlade(&groupsConfig, &awsConfig, nil) logGroups := b.GetLogGroups() for _, group := range logGroups { fmt.Println(*group.LogGroupName) } }, }
View Source
var SawCommand = &cobra.Command{ Use: "saw <command>", Short: "A fast, multipurpose tool for AWS CloudWatch Logs", Long: "Saw is a fast, multipurpose tool for cutting through AWS CloudWatch Logs.", Example: ` saw version saw groups --prefix "aws" saw streams production --prefix "api" saw watch production --prefix "api" --filter "error"`, Run: func(cmd *cobra.Command, args []string) { cmd.HelpFunc()(cmd, args) }, }
View Source
var StreamsCommand = &cobra.Command{ Use: "streams <log group>", Short: "List streams in log group", Long: "", Args: func(cmd *cobra.Command, args []string) error { if len(args) < 1 { return errors.New("listing streams requires log group argument") } return nil }, Run: func(cmd *cobra.Command, args []string) { streamsConfig.Group = args[0] b := blade.NewBlade(&streamsConfig, &awsConfig, nil) logStreams := b.GetLogStreams() for _, stream := range logStreams { fmt.Println(*stream.LogStreamName) } }, }
View Source
var VersionCommand = &cobra.Command{ Use: "version", Short: "Prints the version string", Long: "", Run: func(cmd *cobra.Command, args []string) { fmt.Printf("v%s\n", version) }, }
View Source
var WatchCommand = &cobra.Command{ Use: "watch <log group>", Short: "Continously stream log events", Long: "", Args: func(cmd *cobra.Command, args []string) error { if len(args) < 1 { return errors.New("watching streams requires log group argument") } return nil }, Run: func(cmd *cobra.Command, args []string) { watchConfig.Group = args[0] b := blade.NewBlade(&watchConfig, &awsConfig, &outputConfig) if watchConfig.Prefix != "" { streams := b.GetLogStreams() if len(streams) == 0 { fmt.Printf("No streams found in %s with prefix %s\n", watchConfig.Group, watchConfig.Prefix) fmt.Printf("To view available streams: `saw streams %s`\n", watchConfig.Group) os.Exit(3) } watchConfig.Streams = streams } b.StreamEvents() }, }
Functions ¶
This section is empty.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.