amazon-cloudwatch

CloudWatch logs acting weird

只愿长相守 提交于 2019-12-03 10:35:21
问题 I have two log files with multi-line log statements. Both of them have same datetime format at the begining of each log statement. The configuration looks like this: state_file = /var/lib/awslogs/agent-state [/opt/logdir/log1.0] datetime_format = %Y-%m-%d %H:%M:%S file = /opt/logdir/log1.0 log_stream_name = /opt/logdir/logs/log1.0 initial_position = start_of_file multi_line_start_pattern = {datetime_format} log_group_name = my.log.group [/opt/logdir/log2-console.log] datetime_format = %Y-%m-

How to keep desired amount of AWS Lambda function containers warm

可紊 提交于 2019-12-03 09:19:28
问题 On my project there is REST API which implemented on AWS API Gateway and AWS Lambda. As AWS Lambda functions are serverless and stateless while we make a call to it, AWS starts a container with code of the Lambda function which process our call. According AWS documentation after finishing of lambda function execution AWS don't stop the container and we are able to process next call in that container. Such approach improves performance of the service - only in time of first call AWS spend time

Send an SMS for a cloudwatch Alarm outside of us-east?

﹥>﹥吖頭↗ 提交于 2019-12-03 08:35:07
It looks like AWS does not provide SMS as a protocol for SNS topic subscribers outside of US East. I wanted to hook up my CloudWatch alarms and receive text messages when something breaks but cannot send them to SMS. YES! After some digging I was able to get this to work. It's a little more complicated than just selecting a topic or inputing an alarm but it works great! The key to the solution was using AWS's lambda functions! The flow of data is such: > Alarm triggered > -> Push notification to SNS > -> SNS posts to lambda > -> lambda reposts to SNS on us-east-1 > -> subscriber receives

how to view aws log real time (like tail -f)

∥☆過路亽.° 提交于 2019-12-03 07:21:17
问题 I can view the log using the following command. aws logs get-log-events --log-group-name groupName --log-stream-name streamName --limit 100 what is the command to get feature like tail -f so that i can see the log real time 回答1: Have a look at awslogs. If you happen to be working with Lambda/API Gateway specifically, have a look at apilogs. 回答2: I was really disappointed with awslogs and cwtail so I made my own tool called Saw that efficiently streams CloudWatch logs to the console (and

Can't get AWS Lambda function to log (text output) to CloudWatch

流过昼夜 提交于 2019-12-03 06:13:51
问题 I'm trying to set up a Lambda function that will process a file when it's uploaded to an S3 bucket. I need a way to see the output of console.log when I upload a file, but I can't figure out how to link my Lambda function to CloudWatch. I figured about by looking at the context object that my log group is /aws/lambda/wavToMp3 and the log stream is 2016/05/23/[$LATEST]hex_code_redacted . So I created that group and stream in CloudWatch, yet nothing is being logged to it. 回答1: For the lambda

Invoke AWS Lambda function only once, at a single specified future time

*爱你&永不变心* 提交于 2019-12-03 05:49:01
I want to be able to set a time to invoke an AWS Lambda function, then have that function be invoked then and only then. For example, I want my Lambda function to run at 9:00pm on December 19th, 2017. I don't want it to repeat, I don't want it to invoke now, just at 9:00pm on the 19th. I understand that CloudWatch provides Scheduled Events, and I was thinking that when a time to schedule this reminder for is inputted, a CloudWatch Scheduled Events is created to fire in that amount of time from now (so like if you schedule it at 8:22pm to run at 9pm, it’ll be 38 mins), then it invokes the

AWS Lambda Python 3.7 runtime exception logging

☆樱花仙子☆ 提交于 2019-12-03 05:38:22
Unhandled exceptions thrown while using the Python 3.7 runtime do not seem to be logged to CloudWatch as they are in Python 3.6. How can you setup the logger in Python 3.7 to capture this information? Also posted on AWS forum To replicate: 1. Create a lambda function like so: import logging logger = logging.getLogger() logger.setLevel(logging.DEBUG) def lambda_handler(event, context): logger.info("This shows fine") raise Exception("I failed") 2. Run this function using the Python 3.6 runtime START RequestId: a2b6038b-0e5f-11e9-9226-9dfc35a22dcc Version: $LATEST [INFO] 2019-01-02T07:25:52.797Z

Avoiding INSUFFICIENT DATA in Cloudwatch?

烈酒焚心 提交于 2019-12-03 04:21:55
I have alarms set up to tell me when my load balancers are throwing 5xxs using the HTTPCode_Backend_5XX metric with the sum statistic. The issue is that sum registers 0 as no data points, so when no 5xxs are thrown, the alarm is treated as insufficient data. This is especially frustrating, because I have SNS setup to notify me whenever we get too many 5xxs (alarm state) and whenever things go back to normal. Annoyingly, 0 5xxs means we're in INSUFFICIENT DATA status, but 1 5xx means we're in OK status, so 1 5xx triggers everyone getting notified that stuff is OK. Is there any way around this?

AWS Elastic Beanstalk: Add custom logs to CloudWatch?

半城伤御伤魂 提交于 2019-12-03 03:47:40
问题 How to add custom logs to CloudWatch? Defaults logs are sent but how to add a custom one? I already added a file like this: (in .ebextensions) files: "/opt/elasticbeanstalk/tasks/bundlelogs.d/applogs.conf" : mode: "000755" owner: root group: root content: | /var/app/current/logs/* "/opt/elasticbeanstalk/tasks/taillogs.d/cloud-init.conf" : mode: "000755" owner: root group: root content: | /var/app/current/logs/* As I did bundlelogs.d and taillogs.d these custom logs are now tailed or retrieved

CloudWatch logs acting weird

回眸只為那壹抹淺笑 提交于 2019-12-03 00:03:53
I have two log files with multi-line log statements. Both of them have same datetime format at the begining of each log statement. The configuration looks like this: state_file = /var/lib/awslogs/agent-state [/opt/logdir/log1.0] datetime_format = %Y-%m-%d %H:%M:%S file = /opt/logdir/log1.0 log_stream_name = /opt/logdir/logs/log1.0 initial_position = start_of_file multi_line_start_pattern = {datetime_format} log_group_name = my.log.group [/opt/logdir/log2-console.log] datetime_format = %Y-%m-%d %H:%M:%S file = /opt/logdir/log2-console.log log_stream_name = /opt/logdir/log2-console.log initial