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

后端 未结 11 555
执笔经年
执笔经年 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:07

    I was really disappointed with awslogs and cwtail so I made my own tool called Saw that efficiently streams CloudWatch logs to the console (and colorizes the JSON output):

    You can install it on MacOS with:

    brew tap TylerBrock/saw
    brew install saw
    

    It has a bunch of nice features like the ability to automatically expand (indent) the JSON output (try running the tool with --expand):

    saw watch my_log_group --expand
    

    Got a Lambda you want to see error logs for? No Problem:

    saw watch /aws/lambda/my_func --filter error 
    

    Saw is great because the output is easily readable and you can stream logs from entire log group, not just a single stream in the group. Filtering and watching streams with a certain prefix is also just as easy!

提交回复
热议问题