awslogs
awslogs copied to clipboard
--watch doesn't work in combinationwith --start
When I execute:
awslogs get /ecs/log-name --s 10m -w
What I expect: Return last 10 minutes of logs and then continue show up logs in mode --watch
What I will get instead: Only last 10 minutes of logs is returned, any new logs aren't appearing.
Am I sure about that? Yes I'm. It was quadruplechecked.
I observed a bug related to awslogs get [...] ALL --watch
today, and then I arrived in this bug report here. I don't know if the cases are related or not (maybe I should create a new bug report?).
In my case, --watch
just shows the new logs for the log streams that existed at the time the command started. If new logs are put into newer log streams, they are not "captured" by the --watch
command.
To reproduce this, when using --watch
to check logs from a Lambda function, just edit the Lambda code (e.g. add a new line) and deploy it again. The new code will force the creation of new Lambda environments, which in turn will create new log streams. We need to CTRL+C + re-run the awslogs get [...] ALL --watch
command in order to see the new logs (from the new log streams). While the log streams stay the same, the --watch
command works well.
Note: Maybe this is the expected behavior (and just a matter of the docs not being clear). I don't know what exactly the tool means by ALL
(all stream at the command you ran the command, or all stream from that point and beyond if you combine it with --watch
?)
I saw some bug reports regarding --watch
together with --start
.
And also --watch
together with ALL
: https://github.com/jorgebastida/awslogs/issues/214
I'll try to use the most recent version (pip) to check if some improvement was already done (now I'm using the latest version from Homebrew).