For example, I use the command
aws logs tail group_name --profile abc --follow --since 20m --filter-pattern "{ $.level = 50 }" --format json
to tail all messages with level=50
. The result looks like this:
2024-12-19T09:22:56.057000+00:00 group_name
{
"level": 50,
"time": 1734600176057,
"pid": 1,
"hostname": "...",
"group": "error",
"err": {
"type": "HttpException",
"message": "Forbidden",
"stack": "Error: Forbidden\n at Object.findUserByAuth (/api/src/middleware/utils.js:49:11)\n at process.processTicksAndRejections (node:internal/process/task_queues:95:5)\n at async apiAuth (/api/src/middleware/apiAuth.middleware.js:7:16)",
"status": 403
},
"msg": "Forbidden"
}
2024-12-19T09:33:09.788000+00:00 group_name
{
"level": 50,
"time": 1734600789788,
"pid": 1,
"hostname": "...",
"group": "error",
"err": {
"type": "HttpException",
"message": "Forbidden",
"stack": "Error: Forbidden\n at Object.findUserByAuth (/api/src/middleware/utils.js:49:11)\n at process.processTicksAndRejections (node:internal/process/task_queues:95:5)\n at async apiAuth (/api/src/middleware/apiAuth.middleware.js:7:16)",
"status": 403
},
"msg": "Forbidden"
}
All options can be found here: https://awscli.amazonaws.com/v2/documentation/api/latest/reference/logs/tail.html