Questions tagged [aws-cloudwatch-log-insights]

301 questions
16
votes
1 answer

Count Array Length in JSON Message Object with Amazon Cloudwatch Logs Insights

Is there any way to get the length of an array found in a JSON object parsed by cloud watch log insights? For example, when sending a JSON object of the following structure to log insights: { names: ['john', 'doe', 'joe', 'schmoe'] } it gets…
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
2 answers

How To Filter on a subquery in Amazon Cloudwatch Insights

Are you able to run a filter with a subquery in Cloudwatch Insights? I would like to take the requestID and find all logs related to it. I can run the queries separately but was trying to do it one. Something like this: filter @requestId in (filter…
Matt Kenney
  • 165
  • 1
  • 6
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…
13
votes
2 answers

AWS CloudWatch logs: How to send an email notification when particular error message is logged by lambda

I have to monitor CloudWatch logs for particular lambda. When the specific error message such as HTTP-50X is logged to CloudWatch, then we need to send an email notification to alert that the something is wrong. We need help to create alert email in…
12
votes
2 answers

AWS Cloudwatch Logs Insights: Query into array

I have a Log Group with this kind of messages. { "m": [ { "id": "5b6973c7c86e8689368b4569", "ts": 1634112000.062 }, { "id": "6116d21e02e38f5045079c42", "ts": 1634120807.402 }, { "id":…
icalvete
  • 987
  • 2
  • 16
  • 50
12
votes
0 answers

CloudWatch log insights query scans very slow

I'm looking for help on an issue I'm struggling with. I have created a new log group on CloudWatch, created a few streams and up to 1500 log events in total via AWS putLogEvents method. When I run a simple query to return just the timestamp and…
12
votes
1 answer

How to aggregate the time time between pairs of logs in CloudWatch

Suppose you have logs with some transaction ID and timestamp 12:00: transactionID1 handled by funcX 12:01: transactionID2 handled by funcX 12:03: transactionID2 handled by funcY 12:04: transactionID1 handled by funcY I want to get the time between…
kane
  • 5,465
  • 6
  • 44
  • 72
11
votes
3 answers

How to aggregate logs by field and then by bin in AWS CloudWatch Insights?

I'm trying to do a query that will first aggregate by field count and after by bin(1h) for example I would like to get the result like: # Date Field Count 1 2019-01-01T10:00:00.000Z A 123 2 2019-01-01T11:00:00.000Z A …
Orest
  • 6,548
  • 10
  • 54
  • 84
11
votes
1 answer

How can I visualize timeseries data aggregated by more than one dimension on AWS insights?

I'd like to use cloudwatch insights to visualize a multiline graph of average latency by host over time. One line for each host. This stats query extracts the latency and aggregates it in 10 minute buckets by host, but it doesn't generate any…
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
2 answers

How to query AWS CloudWatch logs using AWS CloudWatch Insights?

I have a lot of AWS Lambda logs which I need to query to find the relevant log stream name, I am logging a particular string in the logs, Which I need to do a like or exact query on. The log format is something like this - Request ID =>…
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
2 answers

Cloudwatch Insights search in multiline logs

Example log: REQUEST-ID:123 Video id=444 REQUEST-ID:123 Request=error REQUEST-ID:534 Video id=555 REQUEST-ID:534 Request=ok Question, how to find Video id of all requests with an error?
8
votes
1 answer

Handling single quote in AWS Cloudwatch Logs Insights

Here is some text that contains single-quotes: Cannot read property 'email' of undefined: When I run the below query with the above text filter @message like /Cannot read property 'email' of undefined/ | stats count() I am not able to get a count.…
user8479984
  • 451
  • 2
  • 9
  • 23
1
2
3
19 20