Questions tagged [amazon-cloudwatchlogs]

Amazon CloudWatch Logs allows aggregation and management of log events sent to it by AWS or custom services. Use this tag when asking about log groups, log streams, and metric filters. Use amazon-cloudwatch instead when asking only about CW metrics or CW alarms.

Amazon CloudWatch Logs allows aggregation and management of log events sent to it by AWS or custom services.

Usage Guidance

  • Use this tag when asking about log groups, log streams, metric filters, etc.
  • Do not use this tag when asking only about CW metrics or CW alarms; use instead.

Resources

862 questions
11
votes
3 answers

Logs to AWS Cloudwatch from Docker Containers

I have a few docker containers running with docker-compose on an AWS EC2 instance. I am looking to get the logs sent to AWS CloudWatch. I was also having issues getting the logs from docker containers to AWS CloudWatch from my Mac running Sierra so…
11
votes
3 answers

CloudWatch Log costing too much

I've been doing some Amazon AWS tinkering for a project that pulls in a decent amount of data. The majority of the services have been super cheap, however, log storage for Cloud Watch is dominating the bill, cloud watch log storage is $13 of the…
mwright
  • 4,099
  • 7
  • 30
  • 40
10
votes
1 answer

CloudWatch Insights Query - How to get a single count from counts

I have a log file which contains playerId values, some players have multiple entries in the file. I want to get an exact distinct count of to unique players, regardless of if they have 1 or multiple entries in the log file. Using the query below it…
10
votes
4 answers

How to print the most recent Cloudwatch log for a certain Lambda function from the AWS CLI?

I am trying to use the AWS CLI and ASK CLI to code an Alexa skill, and I would like to be able to use the Alexa simulator and view the console logs directly from the command line to make it easy, but I am not sure how to view the last one from the…
10
votes
1 answer

Aws Batch not logging to Cloudwatch

I have a docker image through which I make an aws batch job definition. Within the docker I am printing some statements. The job runs and there's a success message. But the logs aren't there in Cloudwatch. It says that no events found. Not even the…
10
votes
1 answer

Does Amazon CloudWatch Logs support a newline character?

We are aggregating our logs to Amazon CloudWatch Logs. We'd like to be able to append a stack trace. Does CloudWatch Log's web interface parse a newline character to make this more readable?
Miriam H.
  • 671
  • 2
  • 8
  • 25
10
votes
2 answers

Is it possible to rename an AWS CloudWatch Log Group?

I have created an AWS CloudWatch log group with a name which was not very future proof. Is it possible to rename such a log group? I could find no option to do this via the CloudWatch console. I guess an alternative would be to export the content of…
10
votes
4 answers

CloudWatch logs acting weird

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 =…
9
votes
1 answer

Cloudwatch Logs Insights working with multiple @messages

I have the following query with the following output: Query: filter @message like /A:|B:/ Output: [INFO] 2020-07-28T09:20:48.406Z requestid A: [{'Delivery': OK, 'Entry': 12323 }] [INFO] 2020-07-28T09:20:48.407Z requestid B: {'MyValue':0} I would…
9
votes
5 answers

"Unable to determine aws-region" when running on-premises Cloudwatch agent

I'm trying to configure the AWS Cloudwatch agent to run on vanilla Ubuntu 18.04, outside of AWS. Every time I run it, I get this error: # /opt/aws/amazon-cloudwatch-agent/bin/amazon-cloudwatch-agent-ctl -a fetch-config -m onPremise -c…
Kevin Burke
  • 61,194
  • 76
  • 188
  • 305
9
votes
1 answer

Enable cloudwatch logs for kinesis firehose cloudformation

I am trying to catch Cloudwatch logs for my firehose to find any errors when sending data to S3 destination. I created a cloudformation template with logging details "CloudWatchLoggingOptions" : { "Enabled" : "true", "LogGroupName":…
9
votes
1 answer

AWS CloudWatch Log Metric Filter with JSON key has character space

When creating an AWS CloudWatch Log Metric Filter, how would you match terms in JSON Log Events where the key has a character space in the name? For example, let's assume there's a log line with JSON element like the…
Max
  • 458
  • 3
  • 10
9
votes
1 answer

Hide sensitive data from cloudwatch logs

We are using AWS cognito for our mobile app and log all the communication between the the app and the server to cloudwatch (loglevel: INFO) I have an endpoint which takes user's password (POST via ssl) to verify authenticity. This password gets…
9
votes
3 answers

How to create cloudwatch event using cloudformation template?

I am using cloudwatch scheduled event to trigger my lambda function after specific time interval. I would like to use cloud-formation template to add this rule in cloudwatch. I have gone through cloudformation templates documentation but I am not…
8
votes
2 answers

CloudWatch log group is not deleted on cdk destroy

I have this CDK code: const logGroup = new LogGroup(this, 'MyAppLogGroup', { logGroupName: 'myapp', retention: RetentionDays.ONE_DAY }); When I run cdk deploy, log group is created in CloudWatch, but when I run cdk destroy, it's not deleted. Is…
Héctor
  • 24,444
  • 35
  • 132
  • 243