Questions tagged [amazon-cloudwatch]

Amazon CloudWatch provides monitoring for AWS cloud resources and the applications customers run on AWS. Use this tag when asking about CW features such as metrics or alarms. Use amazon-cloudwatchlogs instead when asking about log groups, log streams, and metric filters.

From the web site:

Developers and system administrators can use it to collect and track metrics, gain insight, and react immediately to keep their applications and businesses running smoothly. Amazon CloudWatch monitors AWS resources such as Amazon EC2 and Amazon RDS DB instances, and can also monitor custom metrics generated by a customer’s applications and services.

Usage Guidance

  • Use this tag when asking about CW metrics or CW alarms, the CW API, etc.
  • Do not use this tag when asking only about log groups, log streams, metric filters, etc; use instead.
  • Use both if asking about both (for example, if asking about a CW Logs metric filter that aggregates in a CW custom metric that triggers a CW alarm)

Resources

4155 questions
134
votes
5 answers

AWS Log Insights query with string contains

how do I query with contains string in AWS Log insights fields @timestamp, @message filter @message = "user not found" | sort @timestamp desc | limit 20 fields @timestamp, @message filter @message strcontains("User not found") | sort @timestamp…
kumar
  • 8,207
  • 20
  • 85
  • 176
111
votes
4 answers

How do you delete an AWS CloudWatch metric?

I am decommissioning a service in Amazon Web Services DynamoDB. We have various metrics and alarms for our DyDB tables. I am able to delete the alarms using 'aws cloudwatch delete-alarms --alarm-names ...' but I do not see any AWS CLI command to…
MoChaMan
  • 1,219
  • 2
  • 8
  • 6
108
votes
15 answers

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

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
LynAs
  • 6,407
  • 14
  • 48
  • 83
107
votes
17 answers

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

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…
ffxsam
  • 26,428
  • 32
  • 94
  • 144
92
votes
13 answers

AWS Cloudwatch Log - Is it possible to export existing log data from it?

I have managed to push my application logs to AWS Cloudwatch by using the AWS CloudWatch log agent. But the CloudWatch web console does not seem to provide a button to allow you to download/export the log data from it. Any idea how I can achieve…
victorx
  • 3,267
  • 2
  • 25
  • 35
89
votes
3 answers

Parameter ScheduleExpression is not valid

I'm trying to setup a Cloudwatch Scheduled Event and my cron expression seems to be invalid, though I can't figure out why. My cron expression is: cron(5,15,25,35,45,55 * * * *) I want it to run on the 5th, 15th, 25th, 35th, 45th and 55th minute of…
Brooks
  • 7,099
  • 6
  • 51
  • 82
87
votes
6 answers

Specify log group for an AWS lambda?

Is there a way to specify the CloudWatch log group that an AWS lambda logs to? It seems to be generated directly from the lambda name; however, it would be especially convenient to, for example, aggregate multiple lambdas to a single log group. We…
66
votes
3 answers

How to get additional lines of context in a CloudWatch Insights query?

I typically run a query like fields @timestamp, @message | filter @message like /ERROR/ | sort @timestamp desc | limit 20 Is there any way to get additional lines of context around the messages containing "ERROR"? Similar to the A, B, and C flags…
64
votes
5 answers

Amazon Cloudwatch Logs Insights with JSON fields

I am trying to use Logs Insights with data containing JSON in one of the fields, and to parse the JSON fields My data looks like the following when I put it in insights with the starter code fields @timestamp, @message | sort @timestamp desc | limit…
Cyril Duchon-Doris
  • 12,964
  • 9
  • 77
  • 164
59
votes
4 answers

How to query cloudwatch logs using boto3 in python

I have a lambda function that writes metrics to Cloudwatch. While, it writes metrics, It generates some logs in a log-group. INFO:: username: simran+test@example.com ClinicID: 7667 nodename: MacBook-Pro-2.local INFO:: username:…
systemdebt
  • 4,589
  • 10
  • 55
  • 116
57
votes
2 answers

Filter by timestamp query on AWS Cloudwatch Logs Insights

I am trying to use AWS Cloudwatch Logs insights in order to search in some quite old logs of our lambda functions. I am reading this guide on AWS docs, but nowhere is documented how you can filter by timestamp. I have tried the below: fields…
54
votes
3 answers

How to monitor EC2 instances by memory?

Using Cloudwatch you can monitor your EC2 instances by several criteria, such as network usage, CPU usage, and so on… Unfortunately, there is no metric for memory consumption. First of all, just out of curiosity, I would like to know, why? Can…
Golo Roden
  • 140,679
  • 96
  • 298
  • 425
52
votes
2 answers

Cloudwatch Log Alert - How to include error / exception / stack trace data in email notification

I just configured Cloudwatch logs on my ec2 instances and am loving it so far. I also set up alerts for certain keywords, like "ERROR". While the email alert seems to be working fine, I was wondering if there's a way to fine-tune the alert email to…
47
votes
9 answers

Cloudwatch failedinvocation error no logs available

I have set up a Cloudwatch rule event where an ECS task definition is started when a previous task definition is completed. I can see the event triggers the task definition however it fails. The only visibility of this failure is in the rule…
45
votes
3 answers

Avoiding INSUFFICIENT DATA in Cloudwatch?

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…
Eli
  • 36,793
  • 40
  • 144
  • 207
1
2 3
99 100