项目作者: psenger

项目描述 :
A very simple example of cloudwatchlogs query
高级语言: JavaScript
项目地址: git://github.com/psenger/cloudwatchlogs-query-example.git
创建时间: 2019-08-23T00:06:31Z
项目社区:https://github.com/psenger/cloudwatchlogs-query-example

开源协议:

下载


cloudwatchlogs-query-example

A very simple example of cloud watch logs query from NodeJS as a client.

Variables

You can use a .env for or environment variables.

Parameter Type Purpose
AWS_REGION STRING (OPTIONAL) The AWS Region Defaults to ap-southeast-2
AWS_PROFILE STRING The AWS Named Profile to use see AWS Named Profile
TIMEZONE TIME ZONE DB NAME A full list of all DB Names can be found List of tz database time zones
START_DATE ISO 8601 DATE YYYY-MM-DD format start date
HOURS_RANGE VALID JSON ARRAY OF NUMBERS A valid JSON array of consecutive numbers of which represent the 24 hour period to scan. Eg [20,21] would be 9pm and 10pm
CLOUDWATCH_LOG_GROUP STRING The AWS Cloud Watch Log Group Name
QUERY_STRING STRING (OPTIONAL) The query string to send Cloud watch, the default is mentioned below

Default Cloud Watch Query

The default query is:

  1. FIELDS @timestamp, @message
  2. | sort @timestamp desc

As long as timestamp is first, it should work.

You could even do something like this…But have not tested either the of the following

  1. FIELDS @timestamp, @message
  2. | filter @message like /requestid/
  3. | sort @timestamp desc

or

  1. filter @message like /Rate exceeded/
  2. | stats count(*) as exceptionCount by bin(1h)
  3. | sort exceptionCount desc

fini