

# CloudWatch Lambda Insights의 원격 분석 이벤트 예
<a name="Lambda-Insights-example-event"></a>

Lambda Insights가 사용 설정된 Lambda 함수를 호출할 때마다 단일 로그 이벤트가 `/aws/lambda-insights` 로그 그룹에 기록됩니다. 각 로그 이벤트에는 임베디드 지표 형식의 지표가 포함됩니다. 포함된 지표 형식에 대한 자세한 내용은 [로그 내에 지표 포함](CloudWatch_Embedded_Metric_Format.md) 단원을 참조하세요.

이러한 로그 이벤트를 분석하기 위해 다음 방법을 사용할 수 있습니다.
+ [Lambda Insights 지표 보기](Lambda-Insights-view-metrics.md) 단원에 설명된 것처럼 CloudWatch 콘솔의 Lambda Insights 섹션을 활용합니다.
+ CloudWatch Logs Insights를 사용하여 로그 이벤트를 쿼리합니다. 자세한 내용은 [CloudWatch Logs Insights를 사용한 로그 데이터 분석](https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/AnalyzingLogData.html)을 참조하세요.
+ `LambdaInsights` 네임스페이스에 수집된 지표를 검토하고 CloudWatch 지표를 사용하여 이를 그래프로 표시합니다.

다음은 임베디드 지표 형식이 있는 Lambda Insights 로그 이벤트의 예입니다.

```
{
    "_aws": {
        "Timestamp": 1605034324256,
        "CloudWatchMetrics": [
            {
                "Namespace": "LambdaInsights",
                "Dimensions": [
                    [ "function_name" ],
                    [ "function_name", "version" ]
                ],
                "Metrics": [
                    { "Name": "memory_utilization", "Unit": "Percent" },
                    { "Name": "total_memory", "Unit": "Megabytes" },
                    { "Name": "used_memory_max", "Unit": "Megabytes" },
                    { "Name": "cpu_total_time", "Unit": "Milliseconds" },
                    { "Name": "tx_bytes", "Unit": "Bytes" },
                    { "Name": "rx_bytes", "Unit": "Bytes" },
                    { "Name": "total_network", "Unit": "Bytes" },
                    { "Name": "init_duration", "Unit": "Milliseconds" }
                ]
            }
        ],
        "LambdaInsights": {
            "ShareTelemetry": true
        }
    },
    "event_type": "performance",
    "function_name": "cpu-intensive",
    "version": "Blue",
    "request_id": "12345678-8bcc-42f7-b1de-123456789012",
    "trace_id": "1-5faae118-12345678901234567890",
    "duration": 45191,
    "billed_duration": 45200,
    "billed_mb_ms": 11571200,
    "cold_start": true,
    "init_duration": 130,
    "tmp_free": 538329088,
    "tmp_max": 551346176,
    "threads_max": 11,
    "used_memory_max": 63,
    "total_memory": 256,
    "memory_utilization": 24,
    "cpu_user_time": 6640,
    "cpu_system_time": 50,
    "cpu_total_time": 6690,
    "fd_use": 416,
    "fd_max": 32642,
    "tx_bytes": 4434,
    "rx_bytes": 6911,
    "timeout": true,
    "shutdown_reason": "Timeout",
    "total_network": 11345,
    "agent_version": "1.0.72.0",
    "agent_memory_avg": 10,
    "agent_memory_max": 10
}
```

다음은 Lambda 관리형 인스턴스에서 실행 중인 Lambda 함수에 대한 Lambda Insights 로그 이벤트의 예제입니다.

```
{
    "total_network": 16443,
    "tmp_free": 531492864,
    "total_memory": 2048,
    "fd_use": 85,
    "tmp_used": 11984896,
    "execution_environment_init": false,
    "version": "3",
    "event_type": "performance",
    "agent_memory_max": 6,
    "fd_max": 1024,
    "function_name": "cpu-intensive",
    "tx_bytes": 8404,
    "memory_utilization": 3,
    "used_memory_max": 73,
    "memory_utilization_max": 3,
    "cpu_system_time": 541,
    "threads_max": 49,
    "tmp_max": 543477760,
    "cpu_utilization_max": 2,
    "agent_memory_avg": 6,
    "cpu_total_time": 815,
    "rx_bytes": 8039,
    "lambda_mode": "managed-instance",
    "agent_version": "1.0.660.0",
    "_aws": {
        "CloudWatchMetrics": [
            {
                "Namespace": "LambdaInsights",
                "Dimensions": [
                    [
                        "function_name"
                    ],
                    [
                        "function_name",
                        "version"
                    ]
                ],
                "Metrics": [
                    {
                        "Name": "cpu_total_time",
                        "Unit": "Milliseconds"
                    },
                    {
                        "Name": "cpu_utilization",
                        "Unit": "Percent"
                    },
                    {
                        "Name": "cpu_utilization_max",
                        "Unit": "Percent"
                    },
                    {
                        "Name": "tx_bytes",
                        "Unit": "Bytes"
                    },
                    {
                        "Name": "rx_bytes",
                        "Unit": "Bytes"
                    },
                    {
                        "Name": "total_network",
                        "Unit": "Bytes"
                    },
                    {
                        "Name": "used_memory_max",
                        "Unit": "Megabytes"
                    },
                    {
                        "Name": "memory_utilization",
                        "Unit": "Percent"
                    },
                    {
                        "Name": "memory_utilization_max",
                        "Unit": "Percent"
                    },
                    {
                        "Name": "total_memory",
                        "Unit": "Megabytes"
                    },
                    {
                        "Name": "tmp_used",
                        "Unit": "Bytes"
                    },
                    {
                        "Name": "tmp_free",
                        "Unit": "Bytes"
                    }
                ]
            }
        ],
        "Timestamp": 1764164871353,
        "LambdaInsights": {
            "ShareTelemetry": true
        }
    },
    "cpu_utilization": 1,
    "cpu_user_time": 273
}
```