how to view aws log real time (like tail -f)

后端 未结 11 551
执笔经年
执笔经年 2021-01-31 01:13

I can view the log using the following command.

aws logs get-log-events --log-group-name groupName --log-stream-name streamName --limit 100

wha

11条回答
  •  鱼传尺愫
    2021-01-31 02:02

    Note that tailing an aws log is now a supported feature of the official awscli, albeit only in awscli v2, which is not released yet. Tailing and following the logs (like tail -f) can now be accomplished by something like:

    aws logs tail $group_name --follow
    

    To install the v2 version, see the instructions on this page. It was implemented in this PR. To see it demonstrated at the last re:Invent conference, see this video.

    In addition to tailing the logs, it allows viewing the logs back to a specified time using the --since parameter, which can take an absolute or relative time

    aws logs tail $group_name --since 5d
    

    To keep the v1 and v2 versions of awscli separate, I installed awscli v2 into a separate python virtual environment and activate it only when I need to use awscli v2.

提交回复
热议问题