For using AWSCLI (plain one as well as with
cwlogs plugin) seehttp://docs.aws.amazon.com/AmazonCloudWatch/latest/DeveloperGuide/SearchDataFilterPattern.html
For pattern syntax (
plain text , [space separated] as as {JSON syntax} ) see:http://docs.aws.amazon.com/AmazonCloudWatch/latest/DeveloperGuide/FilterAndPatternSyntax.html
For python command line utility
awslogs see https://github.com/jorgebastida/awslogs.AWSCLI: aws logs filter-log-events
AWSCLI is official CLI for AWS services and now it supports logs too.
To show help:
The filter can be based on:
Only
--log-group-name is obligatory.
Times are expressed as epoch using milliseconds (not seconds).
The call might look like this:
It prints 6 columns of tab separated text:
So if you have Linux command line utilities at hand and care only about log record messages for interval from
2015-11-10T14:50:00Z to 2015-11-10T15:00:00Z , you may get it as follows:
AWSCLI with cwlogs plugin
The
cwlogs AWSCLI plugin is simpler to use:
It expects human readable date-time and always returns text output with (space delimited) columns:
On the other hand, it is a bit more difficult to install (few more steps to do plus current
pip requires to declare the installation domain as trusted one).
(if you make typo in last command, just correct it in
~/.aws/config file)
|
Thursday, 12 November 2015
AWS Cloudwatch Logs
http://stackoverflow.com/questions/27804342/how-do-i-filter-and-extract-raw-log-event-data-from-amazon-cloudwatch
No comments:
Post a Comment