Git Product home page Git Product logo

awslogr's Introduction

awslogr

Command line application for accessing Amazon AWS CloudWatch logs

currently supporting:

  • streaming and visualizing event data
  • querying / searching event logs data
  • advanced formatting / output
  • syntax highlightning

How to build and install

  • $ go get github.com/creamdog/awslogr
  • $ go build github.com/creamdog/awslogr
  • $ go install github.com/creamdog/awslogr

Usage

  • for command options run awslogr -h

the first time awslogr is run it will create a configuration file names config.json, make sure to fill in your Amazon AWS credentials, region and CloudWatch endpoint

{
	"accessKey" : "g0fd87gd98g7fdg987",
	"secretKey" : "KJjhfdu6d9asd7a8d76adas76d8sa8",
	"region" : "us-east-1",
	"endpoint" : "https://logs.us-east-1.amazonaws.com",
	"logGroupName" : "nodejs-cluster"
}

###example query > awslogr -groupName "node-cluster" -match "(?i)exception" -fromDate "2014-11-21 00:00:00" -toDate "2014-11-22 00:00:00" -capture "^[^\n]{1,200}" -format "<<{{.Timestamp}}>> {{.Message}}{{.Newline}}"

switches

  • groupName: "the name of the Amazon AWS CloudWatch Log Group, example matches the word 'exception', case insensitive"
  • match: "regular expression to match against (perl style)"
  • fromDate: "time to start searching from (local time)"
  • toDate: "time up until to search to (local time)"
  • capture: "regular expression used to capture or trim output, example matches first 200 characters or until new-line"
  • format: "controls the format logs are outputted using {{.Timestamp}}, {{.Message}} and {{.Newline}}"

output

<<2014-11-21 00:01:23>> SyntaxException, something went wrong with something in the class blah @ blah
<<2014-11-21 00:15:15>> wow, this is some string with the word "exception" in it
<<2014-11-21 00:16:33>> EXCEPTION WOW FAIL

###example, stream events into sql file

awslogr -groupName "node-cluster" -match . -stream -format "INSERT INTO events(timestamp, message) VALUES('{{.Timestamp}}','{{.Timestamp}}');{{.Newline}}" > capture.sql

  • groupName: "the name of the Amazon AWS CloudWatch Log Group, example matches the word 'exception', case insensitive"
  • match: "regular expression to match against (perl style), example matches everything"
  • stream: switch that tells awslogr to capture new events from the HEAD of all logstreams for the current log group.
  • format: "controls the format logs are outputted using {{.Timestamp}}, {{.Message}} and {{.Newline}}"

output into capture.sql

INSERT INTO events(timestamp, message) VALUES('2014-11-21 00:01:23', 'SyntaxException, something went wrong with something in the class blah @ blah');
INSERT INTO events(timestamp, message) VALUES('2014-11-21 00:01:33', 'wow, this is some string with the word "exception" in it');
INSERT INTO events(timestamp, message) VALUES('2014-11-21 00:05:10', 'EXCEPTION WOW FAIL');

awslogr's People

Contributors

creamdog avatar

Stargazers

Bram Swenson avatar

Watchers

 avatar James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.