• Stars
    star
    306
  • Rank 132,108 (Top 3 %)
  • Language
    Go
  • License
    MIT License
  • Created over 5 years ago
  • Updated over 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Multi group and stream log tailing for AWS CloudWatch Logs.

utern

GitHub release Build Status Go Report Card MIT License

The β€œbest of best” way to tail AWS CloudWatch Logs from your terminal.

Abstract

Utern allows you to tail log events from multiple log groups and log streams on AWS CloudWatch Logs. Each result is color coded for quicker debugging. Inspired by stern.

The query is a regular expression so the log group name and stream name can easily be filtered and you don't need to specify the exact name. If a stream is deleted it gets removed from tail and if a new stream is added it automatically gets tailed.

When a log group contains multiple log streams, Utern can tail all of them too without having to do this manually for each one. Simply specify the filter to limit what log events to show.

$ utern [options] log-group-query

So Simple!!

The log-group-query is a regular expression so you could provide "web-\w" to tail web-backend and web-frontend log groups but not web-123.

Features

  • Multi log groups tailing in parallel
    • Regular expression
  • Multi log streams tailing in parallel
    • Regular expression
  • Colorful
    • Quicker debugging
  • Flexible date and time parser
    • Human friendly formats, i.e. 1h20m to indicate 1 hour and 20 minutes ago
    • A full timestamp 2019-01-02T03:04:05Z (RFC3339)
  • Powerful built-in filter
  • Fast
    • Written in golang
  • Easy installation
    • Pre-built binaries

Installation

From source

$ git clone https://github.com/knqyf263/utern.git
$ cd utern
$ go install

Binary (Including Windows)

Go to the releases page, find the version you want, and download the zip file. Unpack the zip file, and put the binary to somewhere you want (on UNIX-y systems, /usr/local/bin or the like). Make sure it has execution bits turned on.

Mac OS X / Homebrew

You can use homebrew on OS X.

$ brew tap knqyf263/utern
$ brew install knqyf263/utern/utern

If you receive an error (Error: knqyf263/utern/utern 64 already installed) during brew upgrade, try the following command

$ brew unlink utern && brew uninstall utern
($ rm -rf /usr/local/Cellar/utern/64)
$ brew install knqyf263/utern/utern

RedHat, CentOS

Download rpm package from the releases page

$ sudo rpm -ivh https://github.com/knqyf263/utern/releases/download/v0.0.1/utern_0.0.1_Tux_64-bit.rpm

Debian, Ubuntu

Download deb package from the releases page

$ wget https://github.com/knqyf263/utern/releases/download/v0.0.1/utern_0.0.1_Tux_64-bit.deb
$ sudo dpkg -i utern_0.0.1_Tux_64-bit.deb

Examples

Some examples are shown below.

List all log groups

$ aws logs describe-log-groups --query "logGroups[].[logGroupName]" --output text

List all log streams

$ aws logs describe-log-streams --log-group-name log-group-name --query "logStreams[].[logStreamName]" --output text

All log streams

$ utern log-group-query

Filter log groups with regular expressions

$ utern "web-\w"

Filter log streams with regular expressions (--stream, -n)

$ utern --stream log-stream-query log-group-query

Filter log streams with a prefix of log stream name (--stream-prefix, -p)

If the log group has many log streams, --stream-prefix will be faster than --stream.

$ utern --stream-prefix log-stream-prefix log-group-query

Filter log streams with a prefix and regular expressions

$ utern -p log-stream-prefix -n log-stream-query log-group-query

Logs after 1 hour ago (--since, -s)

$ utern --since 1h log-group-query

Logs after 2019-01-02 03:04:05 UTC

RFC3339

$ utern --since 2019-01-02T03:04:05Z log-group-query

Logs from 10 minutes ago to 5 minutes ago

$ utern --since 10m --end 5m log-group-query

Usage

NAME:
   utern - Multi group and stream log tailing for AWS CloudWatch Logs

USAGE:
   utern [global options] command [command options] [arguments...]

VERSION:
   0.1.1

COMMANDS:
   help, h  Shows a list of commands or help for one command

GLOBAL OPTIONS:
   --stream value, -n value         Log stream name (regular expression).
                                    Displays all if omitted. If the option
                                    "since" is set to recent time, this option
                                    usually makes it faster than the option
                                    "stream-prefix"
   --stream-prefix value, -p value  Log stream name prefix. If a log group
                                    contains many log streams, this option makes
                                    it faster.
   --since value, -s value          Return logs newer than a relative duration
                                    like 52, 2m, or 3h. (default: "5m")
   --end value, -e value            Return logs older than a relative duration
                                    like 0, 2m, or 3h.
   --profile value                  Specify an AWS profile.
   --code value                     Specify MFA token code directly
                                    (if applicable), instead of using stdin.
   --region value, -r value         Specify an AWS region.
   --filter value                   The filter pattern to use. For more
                                    information, see https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/FilterAndPatternSyntax.html.
   --timestamps                     Print timestamps
   --event-id                       Print event ID
   --no-log-group                   Suppress display of log group name
   --no-log-stream                  Suppress display of log stream name
   --max-length value               Maximum log message length (default: 0)
   --color                          Force color output even if not a tty
   --help, -h                       show help
   --version, -v                    print the version

Contribute

  1. fork a repository: github.com/knqyf263/utern to github.com/you/repo
  2. get original code: go get github.com/knqyf263/utern
  3. work on original code
  4. add remote to your repo: git remote add myfork https://github.com/you/repo.git
  5. push your changes: git push myfork
  6. create a new Pull Request

License

MIT

Author

Teppei Fukuda

More Repositories

1

pet

Simple command-line snippet manager
Go
4,159
star
2

go-plugin

Go Plugin System over WebAssembly
Go
529
star
3

cob

Continuous Benchmark for Go Project
Go
382
star
4

dnspooq

DNSpooq - dnsmasq cache poisoning (CVE-2020-25686, CVE-2020-25684, CVE-2020-25685)
Python
92
star
5

go-rpmdb

RPM DB bindings for go
Go
56
star
6

CVE-2022-0847

The Dirty Pipe Vulnerability
Go
47
star
7

CVE-2020-8617

PoC for CVE-2020-8617 (BIND)
Dockerfile
47
star
8

CVE-2019-6340

Environment for CVE-2019-6340 (Drupal)
Dockerfile
42
star
9

CVE-2021-40346

CVE-2021-40346 PoC (HAProxy HTTP Smuggling)
JavaScript
38
star
10

CVE-2023-50387

KeyTrap (DNSSEC)
Dockerfile
36
star
11

crtsh

API client for crt.sh
Go
31
star
12

go-deb-version

A golang library for parsing deb package versions
Go
29
star
13

CVE-2019-6467

CVE-2019-6467 (BIND nxdomain-redirect)
Dockerfile
28
star
14

azaws

Save temporary security credentials of AWS via Azure AD SSO
Go
28
star
15

CVE-2020-10749

CVE-2020-10749 PoC (Kubernetes MitM attacks via IPv6 rogue router advertisements)
Python
27
star
16

go-cpe

A Go library for CPE (A Common Platform Enumeration 2.3)
Go
26
star
17

remic

Vulnerability Scanner for Detecting Publicly Disclosed Vulnerabilities in Application Dependencies
Go
24
star
18

ndff

A flow-based network monitor with Deep Packet Inspection
C
24
star
19

trivy-issue-action

GitHub Actions for creating GitHub Issues according to the Trivy scanning result
Shell
23
star
20

go-rpm-version

A golang library for parsing rpm package versions
Go
20
star
21

CVE-2020-7461

PoC for DHCP vulnerability (NAME:WRECK) in FreeBSD
Python
15
star
22

CVE-2021-3129

PoC for CVE-2021-3129 (Laravel)
Python
14
star
23

CVE-2018-1111

Environment for DynoRoot (CVE-2018-1111)
Shell
14
star
24

CVE-2021-41773

Path traversal in Apache HTTP Server 2.4.49 (CVE-2021-41773)
Dockerfile
11
star
25

CVE-2018-6389

WordPress DoS (CVE-2018-6389)
10
star
26

CVE-2018-1273

Environment for CVE-2018-1273 (Spring Data Commons)
Dockerfile
9
star
27

nested

Easier way to handle the nested data structure
Go
9
star
28

repacker

Automate the creation of methods that copy from src struct to target struct
Go
8
star
29

CVE-2019-5420

CVE-2019-5420 (Ruby on Rails)
Dockerfile
8
star
30

holiday_jp-go

Japanese holiday
Go
7
star
31

go-apk-version

A golang library for parsing apk package versions
Go
7
star
32

osbpsql

An implementation of the Open Service Broker API for PostgreSQL
Go
7
star
33

stargz-registry

Go
5
star
34

gzip2zip

Gzip to ZIP on-the-fly
Go
4
star
35

redis-rogue-server

Redis Rogue Server
Python
4
star
36

CVE-2018-16509

CVE-2018-16509 (Ghostscript contains multiple -dSAFER sandbox bypass vulnerabilities)
Dockerfile
4
star
37

CVE-2018-11776

Environment for CVE-2018-11776 / S2-057 (Apache Struts 2)
Python
4
star
38

CVE-2018-1304

Java
3
star
39

trivy-aws-enforcer

Go
3
star
40

CVE-2018-7600

CVE-2018-7600 (Drupal)
Python
3
star
41

redis-post-exploitation

Dockerfile
3
star
42

apkindex-archive

Archive for APKINDEX
Python
3
star
43

sshtrace

Go
2
star
44

ssm-to-vuls

Collect package list from AWS System Manager and Send them to Vuls server
Python
2
star
45

nxdomain-redirect

Dockerfile
2
star
46

ssrfnginx

1
star
47

CVE-2018-6376

Joomla!, Second Order SQL Injection
1
star
48

presentation

Python
1
star
49

redis-exploitation

CONFIG SET
Dockerfile
1
star
50

setup-softether

for setup SoftEtherVPN
Shell
1
star
51

zig-wasm-example

Zig + Wasm + wazero
Go
1
star
52

cve-2015-5477

PoC for BIND9 TKEY assert DoS (CVE-2015-5477)
Python
1
star
53

rasm

Wasm runtime written in Rust
Rust
1
star
54

alma

Alma is an open-source Alert Manager with DSL
Ruby
1
star