You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -431,7 +431,7 @@ After that, we use this logger in our application code to record the required in
431
431
{
432
432
"asctime": "2021-11-22 15:32:02,145",
433
433
"levelname": "INFO",
434
-
"name": "hello",
434
+
"name": "APP",
435
435
"message": "Request from unknown received"
436
436
}
437
437
```
@@ -461,7 +461,7 @@ from aws_lambda_powertools import Logger
461
461
from aws_lambda_powertools.event_handler.api_gateway import ApiGatewayResolver
462
462
from aws_lambda_powertools.logging import correlation_paths
463
463
464
-
logger = Logger(service="order")
464
+
logger = Logger(service="APP")
465
465
466
466
app = ApiGatewayResolver()
467
467
@@ -490,7 +490,6 @@ Let's break this down:
490
490
***L24**: We also instruct Logger to use the incoming API Gateway Request ID as a [correlation id](./core/logger.md##set_correlation_id-method) automatically.
491
491
***L24**: Since we're in dev, we also use `log_event=True` to automatically log each incoming request for debugging. This can be also set via [environment variables](./index.md#environment-variables){target="_blank"}.
492
492
493
-
We can now search our logs by the request ID to find a specific operation. Additionally, we can also search our logs for function name, Lambda request ID, Lambda function ARN, find out whether an operation was a cold start, etc.
494
493
495
494
This is how the logs would look like now:
496
495
@@ -500,7 +499,7 @@ This is how the logs would look like now:
500
499
"location":"hello:17",
501
500
"message":"Request from unknown received",
502
501
"timestamp":"2021-10-22 16:29:58,367+0000",
503
-
"service":"hello",
502
+
"service":"APP",
504
503
"cold_start":true,
505
504
"function_name":"HelloWorldFunction",
506
505
"function_memory_size":"256",
@@ -510,6 +509,8 @@ This is how the logs would look like now:
510
509
}
511
510
```
512
511
512
+
We can now search our logs by the request ID to find a specific operation. Additionally, we can also search our logs for function name, Lambda request ID, Lambda function ARN, find out whether an operation was a cold start, etc.
513
+
513
514
From here, we could [set specific keys](./core/logger.md#append_keys-method){target="_blank"} to add additional contextual information about a given operation, [log exceptions](./core/logger.md#logging-exceptions){target="_blank"} to easily enumerate them later, [sample debug logs](./core/logger.md#sampling-debug-logs){target="_blank"}, etc.
514
515
515
516
By having structured logs like this, we can easily search and analyse them in [CloudWatch Logs Insight](https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/AnalyzingLogData.html){target="_blank"}.
0 commit comments