@exodus/aws-multilog

1.3.0 • Public • Published

aws multi-role log viewer

description

Uses AWS CloudWatch Insights to query multiple log groups across multiple STS roles in parallel, and then combines and sorts them all by timestamp. The default query it uses is fields @message, @timestamp in the last 5 minutes

installation

npm i @exodus/aws-multilog -g

Requirements:

Install pip install qaws, pip install awsume

Then configure your amazon config including mfa_token and source_profile for all roles...

For example in my ~/.aws/config I have

[profile staging]
region = us-east-1
output = json
mfa_serial     = arn:aws:iam::myuserid:mfa/myusername

[profile staging-myrole]
source_profile = staging
role_arn       = arn:aws:iam::accountid:role/rolename

and in ~/.aws/credentials I have:

[staging]
aws_access_key_id = myid
aws_secret_access_key = mykey

if you have mfa_serial specified then make sure you do awsume staging (or whatever your role is) to ensure your mfa token is cached and working

configuration

Create the file ~/.aws/multilog.json to hold your log group configuration:

[
  {
    "profile": "staging",
    "groups": [
      "/aws/lambda/staging-lambda",
      "/aws/lambda/database-lambda"
    ],
    "color": "blue"
  },
  {
    "profile": "production",
    "groups": [
      "/aws/lambda/production-lambda"
    ],
    "color": "blueBright"
  }
]

usage

$ aws-multilog
# defaults to 5 minutes, queries all messages

$ aws-multilog --time 1h
# all messages in last hour

$ aws-multilog --filter 'level = "error"'
# only get log level error (assuming your logs are json w/ "level": "error")

$ aws-multilog --time 1h --end 30m
# all messages between 1h to 30min ago

$ aws-multilog --limit 9999
# default is 1000, max is 9999

options

  • -q - quiet mode
  • -v - verbose mode (show query metadata)
  • --filter - shorthand for adding a insights filter
  • --time - specify custom start time, i.e. 5m or 1h
  • --end - specify end time
  • --json - ndjson outpout
  • --query - specify custom insights query string
  • --limit - default 1000, max 9999

Readme

Keywords

none

Package Sidebar

Install

npm i @exodus/aws-multilog

Weekly Downloads

13

Version

1.3.0

License

MIT

Unpacked Size

7.04 kB

Total Files

4

Last publish

Collaborators

  • marcos.kichel
  • kryptkeep
  • andrewtoth-exodus
  • mmehta-10
  • tunguyennnnn
  • dimartiro
  • cdotta-exodus
  • awesomeniko
  • mbaraniak-exodus
  • hasakura
  • milanvojnovic
  • kklash
  • shehryar6
  • rec
  • awilson-rs
  • ggabarrin-rs
  • r4vn
  • exorich
  • cryptosgr
  • mol0d
  • yevhenii_molodyk
  • yilmazbahadir
  • muratso
  • exoleo
  • 633kh4ck
  • ossel
  • davidfraga610
  • clarkexo
  • andrewrexo
  • james-gre
  • juraex
  • richayotte
  • ralph.ba
  • angelloz
  • joshuabot
  • jamiemaw
  • exodus-justin.za
  • javiexodus
  • rg911
  • alex.alexandrius
  • filipexodus
  • ryansquared-npm
  • andrescarreon
  • florianmathieu
  • janwe
  • fboucquez
  • skapala
  • umito
  • lanahizzle
  • iaacek
  • ps.mcnally
  • akinncar
  • matias.la
  • voltagebots
  • kwwood
  • sergii_bo
  • alexandrbbm
  • danh.t.vo
  • ezenwankwogabriel
  • meniem
  • mzndako
  • kevva
  • feri42
  • jprichardson
  • farisissa
  • ryanzim
  • headfire
  • gutenye
  • mosesbot
  • roccomuso
  • dcastagnoli
  • sonaye
  • nareg_exodus
  • ves
  • tenaciousmv
  • asyakost
  • bulgakovk
  • chalker
  • andrejb
  • jaydp17
  • olistic
  • joepie91
  • merlz
  • vbonini
  • devopsrobot
  • jenish-sojitra
  • nachoalvarez
  • giovannirco
  • diegomura
  • lanre-mark
  • sunilagrawal
  • guillecura
  • mariosvlad
  • federico-po
  • pagan404