Documentation ¶
Index ¶
- Constants
- Variables
- func ColorLevel(l ecslogs.Level) string
- func GetTime(value string, reference time.Time) (time.Time, error)
- func ParseAWSTimestamp(i *int64) time.Time
- func SetMaxStreams(max int)
- func Unique(args ...string) string
- type ByCreationTime
- type ByLastEvent
- type CloudwatchLogsReader
- type Event
Constants ¶
const (
// MaxEventsPerCall is the maximum number events from a filter call
MaxEventsPerCall = 10000
)
const (
// ShortTimeFormat is a short format for printing timestamps
ShortTimeFormat = "01-02 15:04:05"
)
Variables ¶
var ( Red = color.New(color.FgRed).SprintFunc() Green = color.New(color.FgGreen).SprintFunc() Yellow = color.New(color.FgYellow).SprintFunc() Blue = color.New(color.FgBlue).SprintFunc() Magenta = color.New(color.FgMagenta).SprintFunc() Cyan = color.New(color.FgCyan).SprintFunc() White = color.New(color.FgWhite).SprintFunc() )
These color functions are used by output templates to control text color
var (
// MaxStreams is the maximum number of streams you can give to a filter call
MaxStreams = 100
)
var TaskUUIDPattern = regexp.MustCompile(`^[[:alnum:]]{8}-[[:alnum:]]{4}-[[:alnum:]]{4}-[[:alnum:]]{4}-[[:alnum:]]{12}$`)
TaskUUIDPattern is used to match task UUIDs
Functions ¶
func ColorLevel ¶
ColorLevel takes a log level and colors it based on severity
func GetTime ¶
GetTime tries to parse given string as golang duration, then RFC3339 time and finally as a Unix timestamp. If any of these were successful, it returns a time.Time object. In case of duration input, the returned Time is computed as the given reference time minus the amount of the duration.
func ParseAWSTimestamp ¶
ParseAWSTimestamp takes the time stamp format given by AWS and returns an equivalent time.Time value
func SetMaxStreams ¶ added in v1.2.0
func SetMaxStreams(max int)
Set the maximum number of streams for describe/filter calls
Types ¶
type ByCreationTime ¶
type ByCreationTime []Event
ByCreationTime is used to sort events by their creation time
func (ByCreationTime) Len ¶
func (b ByCreationTime) Len() int
func (ByCreationTime) Less ¶
func (b ByCreationTime) Less(i, j int) bool
func (ByCreationTime) Swap ¶
func (b ByCreationTime) Swap(i, j int)
type ByLastEvent ¶
type ByLastEvent []*cloudwatchlogs.LogStream
ByLastEvent is used to sort log streams by last event timestamp
func (ByLastEvent) Len ¶
func (b ByLastEvent) Len() int
func (ByLastEvent) Less ¶
func (b ByLastEvent) Less(i, j int) bool
func (ByLastEvent) Swap ¶
func (b ByLastEvent) Swap(i, j int)
type CloudwatchLogsReader ¶
type CloudwatchLogsReader struct {
// contains filtered or unexported fields
}
CloudwatchLogsReader is responsible for fetching logs for a particular log group
func NewCloudwatchLogsReader ¶
func NewCloudwatchLogsReader(group string, streamPrefix string, start time.Time, end time.Time) (*CloudwatchLogsReader, error)
NewCloudwatchLogsReader takes a group and optionally a stream prefix, start and end time, and returns a reader for any logs that match those parameters.
func (*CloudwatchLogsReader) Error ¶
func (c *CloudwatchLogsReader) Error() error
Error returns an error if one occured while streaming events.
func (*CloudwatchLogsReader) ListStreams ¶
func (c *CloudwatchLogsReader) ListStreams() ([]*cloudwatchlogs.LogStream, error)
ListStreams returns any log streams that match the params given in the reader's constructor. Will return at most `MaxStreams` streams
func (*CloudwatchLogsReader) StreamEvents ¶
func (c *CloudwatchLogsReader) StreamEvents(ctx context.Context, follow bool) <-chan Event
StreamEvents returns a channel where you can read events matching the params given in the readers constructor. The channel will be closed once all events are read or an error occurs. You can check for errors after the channel is closed by calling Error()
type Event ¶
type Event struct { ecslogs.Event Stream string Group string ID string IngestTime time.Time CreationTime time.Time }
Event represents a log event
func NewEvent ¶
func NewEvent(cwEvent cloudwatchlogs.FilteredLogEvent, group string) Event
NewEvent takes a cloudwatch log event and returns an Event