aws / aws/aws-toolkit-vscode

Allow changing default cloudwatch logs getLogEvents startFromHead option

Open
#3,295 3 comments 0 reactions 0 assignees View on GitHub
feature-request service:cloudwatch
Dominant language
TypeScript
Stars
2k
Forks
807
Avg merge
10h 12m
Merged PRs (30d)
7

Description

## Problem

When using "View Log Stream..." on MANY log streams I get an empty document, BUT in aws console I can see that I have events in that log stream.

I did some more investigations and apparently also using `aws cli` (or boto3) on those logstreams, I get no events, ex.:
```sh
aws logs get-log-events --log-group-name /aws-glue/jobs/error --log-stream-name REDACTED

{
"events": [],
"nextForwardToken": "f/REDACTED/s",
"nextBackwardToken": "b/REDACTED/s"
}
```
Again using same rights in aws console I see events for the exact same log stream.

After additional digging, I found someone else recently had this problem: https://stackoverflow.com/questions/75678467/boto3-client-get-log-events-returns-no-events-only-when-startfromhead-is-false

**The problem is that for "I don't know why" reason, certain log streams return events ONLY if `startFromHead` is set to `true`.
And unfortunately the default value is `false`.**

## Expected behavior
Not sure this is a bug with aws getLogEvents that will be fixed (I'll open a question on this), but until then it would help if I can set somewhere in the configuration that I want to return the logs `starting with the head` and pass this to the CloudWatchLogs.GetLogEventsRequest

Contributor guide

Open the contributing guide

Research direction

Start by locating the View Log Stream implementation and references to CloudWatchLogs.GetLogEventsRequest, then inspect how extension configuration is defined and passed to that request. Done means users can configure startFromHead and the selected log streams return events when the option is enabled.

Written by the indexing model from the issue text.

Assessment

Tech stack
aws, typescript
Domain
cloud, observability-sre
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.