cmd

package
v0.1.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 18, 2018 License: MIT Imports: 6 Imported by: 12 modules, 12 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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, 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, 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, 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, &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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL