Skip to content

steffakasid/lc

Repository files navigation

lc - Log Collector 4 AWS

License Apache%202.0 blue link:https://github.com/steffakasid/lc/actions/workflows/codeql-analysis.yml link:https://github.com/steffakasid/lc/actions/workflows/release.yml link:https://github.com/steffakasid/lc/actions/workflows/go-test.yml

This tool is intended to collect logs from AWS LogInsights.

Installation

brew install steffakasid/lc/lc

Or brew tap steffakasid/lc and then brew install lc.

brew help, man brew or check Homebrew’s documentation.

Usage

lc [flags]

Preqrequisites and configuration

lc uses already provided credentials in ~/.aws/credentials also it uses the central configuration in ~/.aws/config!

Note
You can find out more about configuration options (e.g. retries etc.) at cli configure files.

Configure retries

If you need to change the retry behavior I use the following settings inside my ~/.aws/config in my [default] section:

retry_mode = adaptive
max_attempts = 20

Examples

lc
lc -g '/aws/containerinsights/eks-prod/application' -d 1h
lc -g '/aws/containerinsights/eks-prod/application' -d 1h -p gw-eks-int
lc -g '/aws/containerinsights/eks-prod/application' -d 1h -p gw-eks-int -o
lc -g '/aws/containerinsights/eks-prod/application' -d 1h -p gw-eks-int -o -f '{($.kubernetes.namespace_name=my-namespace) && ($.log=*multistep*)}'
lc -g '/aws/containerinsights/eks-test/application' -d 2s -t yaml -i log -i kubernetes.pod_name -i metadata.Timestamp

Flags

-d, --duration string

Duration(1w, 1d, 1h etc.) from today backwards of logs to get.

-e, --end-time string

The end time of logs to get. If not set we’ll use today. Formt: 2006-01-02T15:04:05Z or 2006-01-02T15:04:05+07:00

-f, --filter-pattern string

The filter pattern to filter logs.

-?, --help

Print usage information

-l, --limit int32

The maximum number of events to return. (default 10000)

-g, --log-group string

The log group name to get logs from.

-n, --logstream-names strings

Filters the results to only logs from the log streams in this list.

-p, --logstream-prefix string

Filters the results to include only events from log streams that have names starting with this prefix.

-o, --output

Output logs to file

-s, --start-time

string The start time of logs to get. Formt: 2006-01-02T15:04:05Z or 2006-01-02T15:04:05+07:00

-v, --version

Print version information

Development

Generate mock using mockery

In order to test I used mockery to create the mocks:

cd internal
mockery --name <interface-name> --with-expecter

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 3

  •  
  •  
  •  

Languages