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
25
votes
3 answers

"An error occurred: LogGroup - already exists" while trying to deploy Serverless

after running sls deploy -v && sls s3deploy as I normally do, I ran into this issue: ... CloudFormation - CREATE_FAILED - AWS::Logs::LogGroup - CallTextractLogGroup ... CloudFormation - CREATE_FAILED - AWS::IAM::Role -…
24
votes
6 answers

How to parse mixed text and JSON log entries in AWS CloudWatch for Log Metric Filter

I am trying to parse log entries which are a mix of text and JSON. The first line is text representation and the next lines are JSON payload of the event. One of the possible examples are: 2016-07-24T21:08:07.888Z [INFO] Command completed…
Mike Chaliy
  • 25,801
  • 18
  • 67
  • 105
22
votes
2 answers

aws cloudwatch logs filter pattern include lines before and/or after matching pattern

Is there a way to include N lines before and/or after a matching pattern in AWS CloudWatch Logs? Let's say I have this query and would like 3 lines before and after each match. aws logs filter-log-events --log-group-name my-group --filter-pattern…
21
votes
4 answers

How to Send Kubernetes Logs to AWS CloudWatch?

AWS CloudWatch Logs in Docker Setting an AWS CloudWatch Logs driver in docker is done with log-driver=awslogs and log-opt, for example - #!/bin/bash docker run \ --log-driver=awslogs \ --log-opt awslogs-region=eu-central-1 \ --log-opt…
Adam Matan
  • 128,757
  • 147
  • 397
  • 562
20
votes
6 answers

CloudWatch Insights: get logs of errored lambdas

A lambda can have a result that is either a success or an error. I want to see the logs of lambda that errored. I am trying to do that via a CloudWatch Insights query. How can I do this?
20
votes
2 answers

AWS Cloudwatch logs with Docker Container - NoCredentialProviders: no valid providers in chain

My docker-compose file: version: '2' services: scraper: build: ./Scraper/ logging: driver: "awslogs" options: awslogs-region: "eu-west-1" awslogs-group: "doctors-logs" awslogs-stream:…
17
votes
2 answers

How to Import Logs From An Amazon S3 Bucket to cloudwatch

I have Exported the aws cloudwatch Log Data to Amazon S3 Using the AWS CLI. Followed kb: https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/S3ExportTasks.html. Any idea how we can import the logs saved in s3 for analysing the data?
16
votes
1 answer

send notification alert when AWS Lambda function has an error

I have a AWS Lambda function running some process in my infrastructure. The Lambda is triggered every 8 hours using a CloudWatch rule. I am trying to raise a notification if any error happens into the Lambda process. I tried to use SES but that…
15
votes
2 answers

Is there a way to paginate AWS CloudWatch Logs Insights

is there a way to paginate AWS CloudWatch Logs Insights? Thank you. I was thinking something like below but that doesn't work fields @message | page 2 | limit 20 EDIT: I am currently accessing the logs via the Logs Insight In my app, I am…
15
votes
3 answers

Elastic Beanstalk CloudWatch Log streaming stops working – How to debug

My Elastic Beanstalk environment is stopping streaming node.js events to CloudWatch Logs. Streaming works fine for a view minutes on a new instance. After a view minutes no more logs show up in CloudWatch. I set up AWS Elastic Beanstalk to stream…
14
votes
2 answers

AWS CloudWatch Insights query field with hyphen in name

Trying to run CloudWatch Insights query containing reqHeaders.x-forwarded-for, like fields @timestamp, status, err, method, url, req_id, reqHeaders.x-forwarded-for | filter status >= 400 | sort @timestamp desc | limit 10 but this field is always…
14
votes
4 answers

Missing log lines when writing to cloudwatch from ECS Docker containers

(Docker container on AWS-ECS exits before all the logs are printed to CloudWatch Logs) Why are some streams of a CloudWatch Logs Group incomplete (i.e., the Fargate Docker Container exits successfully but the logs stop being updated abruptly)?…
14
votes
2 answers

Why did Cloudwatch stop logging Sagemaker?

I have a Sagemaker instance running for a while now. I didn't change anything in between, but now I can't see new logs on Cloudwatch anymore. The old logs are still there, but no new ones since 2 days. The Sagemaker instance is still running. It's…
Martin Thoma
  • 124,992
  • 159
  • 614
  • 958
14
votes
1 answer

CloudWatch logs delayed for a lambda function

It seems that I have a delay with the CloudWatch log of one of my lambda function's. I have a lambda function that gets triggered by a Kinesis stream. The lambda function writes records into a DynamoDB table. I know for sure that the lambda…
kord
  • 979
  • 14
  • 24
14
votes
2 answers

How does multi-line logging work in Lambda -> CloudWatch

My multi-line logging events all end up multi-events - one event per line. According to the documentation: Each call to LambdaLogger.log() results in a CloudWatch Logs event... but then: However, note that AWS Lambda treats each line returned by…
1
2
3
57 58