-
Notifications
You must be signed in to change notification settings - Fork 421
message located last at the log line. #138
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
Comments
Hi Yuriy - Thanks for raising your first issue and feature request under the AWS Labs org :) I see what you mean, and hopefully that's a quick fix:
I've just tagged as a good first contribution issue in case you or anyone reading this later want to give this a try. Otherwise, I'll implement this later next week :) |
@heitorlessa @ypolon7kiy I fixed this in #140. I think the order should be |
@heitorlessa @ypolon7kiy - otherwise if there is a strong preference i could make it But having the message after the location is handy to match things up to the implementation code. |
I think the challenge @ypolon7kiy is having is that he's using the standard CloudWatch Logs console, and the line preview shows only the first key (timestamp) hence the ask for bringing up as first. That's why DAZN Lambda Powertools for JS does this: https://github.com/getndazn/dazn-lambda-powertools/blob/d870d55bbbe9851705b1e860e4a45d2968edaaf5/packages/lambda-powertools-logger/index.js#L82 I'd wait for @ypolon7kiy to chime back and confirm the challenge he's having. Customers using ELK, CloudWatch Log Insights, and any advanced Log Analytics tool allows you to change the order as you see fit regardless of how the logs have been ingested, but I still suspect that's not the case with Yuriy |
Hi @heitorlessa and @michaelbrewer . 2020-08-27T12:21:21.894+03:00 | {"timestamp": "2020-08-27 09:21:21,894", "level": "INFO", "location": "lambda_handler:25", "service": "aaa", "sampling_rate": 0.0, "cold_start": false, "function_name": "TestPeriod", "function_memory_size So the timestamp appearing twice at the beginning. But what you decide. |
@ypolon7kiy @heitorlessa i updated it to be configurable as well and the default is >>> logger = Logger(format_key=["message"])
>>> logger.info("Message")
{'message': 'Message', 'level': 'INFO', 'location': 'test_log_dict_key_custom_seq:139', 'timestamp': '2020-08-27 11:40:33,718', 'service': 'service_undefined', 'sampling_rate': 0.0} |
@ypolon7kiy - you should check out #140 and see if this fits in with what you are expecting. |
@ypolon7kiy could you tell me whether the docs match your expectation? https://github.com/awslabs/aws-lambda-powertools-python/pull/148/files Once merged, this feature and docs will be available in the next release (1.5.0) |
@heitorlessa |
This has now available in 1.5.0 release |
Is your feature request related to a problem? Please describe.
I'm always frustrated when i try to read logs, but the message is located at the end of line, so thre is always need to open each line in CloudWatch.
In that way one cannot read the app flow logic easily.
Describe the solution you'd like
move message to the start of the line, or after timestamp.
Can be solved in:
logger/formatter.py
format(self, record)
PROBLEM EXAMPLE:
{"timestamp": "2020-08-27 08:55:33,265", "level": "INFO", "location": "lambda_handler:9", "service": "aaa", "sampling_rate": 0.0, "cold_start": true, "function_name": "TestPeriod", "function_memory_size": "128", "function_arn": "arn:aws:lambda:eu-central-1:508054367788:function:TestPeriod", "function_request_id": "d55d25b5-db25-446d-9c04-10cc79800981", "order_id": "aaa", "message": {"operation": "collect_payment"}}
The text was updated successfully, but these errors were encountered: