Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Convenience: Ability to fetch logs around a specified timestamp #219

Open
Kantis opened this issue Oct 7, 2021 · 1 comment
Open

Convenience: Ability to fetch logs around a specified timestamp #219

Kantis opened this issue Oct 7, 2021 · 1 comment

Comments

@Kantis
Copy link

Kantis commented Oct 7, 2021

Problem

It's frustrating to see surrounding events when you find something of interest in the log.

cw tail my-log-group -b7d | grep ERROR

> 2021-10-04T09:20:02,747 <ERROR> <45c352fb-63c8-473c-93f0-14d1cf34a879> ERROR for some reason

# Inconvenient part, constructing the surrounding timestamps
cw tail my-log-group --start="2021-10-04T09:19:00" --end="2021-10-04T09:21:00" 

Proposal

Provide an additional parameter -l, --relative-to="<Full DATE/DATETIME>" to the cw tail function, that can be used in conjunction to the relative parameters for -b, -e. Example:

cw tail my-log-group -l "2021-10-04T09:19:00" -b1m -e1m

Also it could be nice if -b and -e supported down to millisecond precision? Perhaps worthy of a separate ticket..

Alternatives

I considered whether the before/after should be merged into a single additional parameter, but I think it's more natural this way..

@lucagrulla
Copy link
Owner

Hi @Kantis
Thank you for your suggestion.
I can see what you want to achieve, and I believe you can achieve it with grep A and B options:
i.e. cw tail my-log-group -b7d | grep ERROR -A 2 -B 2 will give you 2 lines before and after the grep hit.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants