

本文為英文版的機器翻譯版本，如內容有任何歧義或不一致之處，概以英文版為準。

# 在 Detective 中查詢原始日誌
<a name="query-raw-logs-detective"></a>

將 Detective 與 Security Lake 整合之後，Detective 會開始從 Security Lake 提取與 AWS CloudTrail 管理事件和 Amazon Virtual Private Cloud (Amazon VPC) 流程日誌相關的原始日誌。

**注意**  
在 Detective 內查詢原始日誌無須額外付費。其他 AWS 服務的使用費，包括 Amazon Athena，仍以公告費率計費。

AWS CloudTrail 管理事件可用於下列設定檔：
+ AWS 帳戶
+ AWS 使用者
+ AWS 角色
+ AWS 角色工作階段
+ Amazon EC2 執行個體
+ Amazon S3 儲存貯體
+ IP 位址
+ Kubernetes 叢集
+ Kubernetes Pod
+ Kubernetes 主體
+ IAM 角色
+ IAM 角色工作階段
+ IAM 使用者

Amazon VPC Flow Logs 可用於下列設定檔：
+ Amazon EC2 執行個體
+ Kubernetes Pod

如需如何使用 Detective 主控台搭配 Amazon Security Lake 使用 Amazon Detective 的示範，請觀看下列影片：

[![AWS Videos](http://img.youtube.com/vi/https://www.youtube.com/embed/A_EWd2lvVW0/0.jpg)](http://www.youtube.com/watch?v=https://www.youtube.com/embed/A_EWd2lvVW0)


**查詢 AWS 帳戶的原始日誌**

1. 打開 Detective 主控台，網址為 [https://console.aws.amazon.com/detective/](https://console.aws.amazon.com/detective/)。

1. 在導覽窗格中，選擇**搜尋**，然後搜尋 `AWS account`。

1. 在**整體 API 呼叫量**區段中，選擇**顯示範圍時間的詳細資訊**。

1. 您可以在此開始**查詢原始日誌**。

![在原始日誌預覽資料表中，您可以檢視透過從 Security Lake 查詢資料擷取的日誌和事件。如需有關原始事件日誌的詳細資訊，您可以檢視 Amazon Athena 中顯示的資料。](http://docs.aws.amazon.com/zh_tw/detective/latest/userguide/images/query-raw-logs-awsaccount.png)


在**原始日誌預覽**資料表中，您可以檢視透過從 Security Lake 查詢資料擷取的日誌和事件。如需有關原始事件日誌的詳細資訊，您可以檢視 Amazon Athena 中顯示的資料。

![在原始日誌預覽資料表中，您可以檢視透過從 Security Lake 查詢資料擷取的日誌和事件。如需有關原始事件日誌的詳細資訊，您可以檢視 Amazon Athena 中顯示的資料。](http://docs.aws.amazon.com/zh_tw/detective/latest/userguide/images/query-raw-log-table.png)


您可以在查詢原始日誌資料表中**取消查詢請求**、**在 Amazon Athena 中查看結果**以及**下載結果**為逗號分隔值 (.csv) 設定檔。

如果您在 Detective 中查看日誌，但查詢未傳回任何結果，這可能因以下原因造成。
+ 原始日誌可能會先在 Detective 中變成可用，然後才在 Security Lake 日誌表中顯示。請稍後再試。
+ Security Lake 可能會缺少日誌。如果您等待了很久的時間，則表示 Security Lake 缺少日誌。請與您的 Security Lake 管理員聯絡以解決問題。

**Topics**
+ [查詢 AWS 角色的原始日誌](#query-log-geo-location)
+ [查詢 Amazon EKS 叢集的原始日誌](#query-log-eks-cluster)
+ [查詢 Amazon EC2 執行個體的原始日誌](#query-log-vpc)

## 查詢 AWS 角色的原始日誌
<a name="query-log-geo-location"></a>

如果您想要了解新地理位置中 AWS 角色的活動，可以在 Detective 主控台中進行。



**查詢 AWS 角色的原始日誌**

1. 打開 Detective 主控台，網址為 [https://console.aws.amazon.com/detective/](https://console.aws.amazon.com/detective/)。

1. 從 Detective **摘要**頁面**新觀察到的地理位置**區段中，記下 AWS 角色。

1. 在導覽窗格中，選擇**搜尋**，然後搜尋 `AWS role`。

1.  針對該 AWS 角色，展開 資源以顯示該資源從該 IP 地址發出的特定 API 呼叫。

1. 選擇您要調查的 API 呼叫旁邊的放大鏡圖示，以開啟**原始日誌預覽**表。  
![在原始日誌預覽資料表中，您可以檢視透過從 Security Lake 查詢資料擷取的日誌和事件。如需有關原始事件日誌的詳細資訊，您可以檢視 Amazon Athena 中顯示的資料。](http://docs.aws.amazon.com/zh_tw/detective/latest/userguide/images/query-raw-logs-awsrole.png)

## 查詢 Amazon EKS 叢集的原始日誌
<a name="query-log-eks-cluster"></a>

1. 打開 Detective 主控台，網址為 [https://console.aws.amazon.com/detective/](https://console.aws.amazon.com/detective/)。

1. 從 Detective **摘要**頁面 **建立最多 Pod 的容器叢集**區段中，導覽至 Amazon EKS 叢集。

1. 在 **Amazon EKS 叢集詳細資訊**頁面中，選取 **Kubernetes API 活動**索引標籤。

1. 在**涉及此 Amazon EKS 叢集的整體 Kubernetes API 活動**區段中，選擇**範圍時間的顯示詳細資訊**。

1. 您可以在此開始**查詢原始日誌**。

## 查詢 Amazon EC2 執行個體的原始日誌
<a name="query-log-vpc"></a>



1. 打開 Detective 主控台，網址為 [https://console.aws.amazon.com/detective/](https://console.aws.amazon.com/detective/)。

1. 在導覽窗格中，選擇**搜尋**，然後搜尋 `Amazon EC2 instance`。

1. 在**整體 VPC 流量**區段中，選擇您要調查的 API 呼叫旁邊的放大鏡圖示，以開啟**原始日誌預覽**表。

1. 您可以在此開始**查詢原始日誌**。  
![在原始日誌預覽資料表中，您可以檢視透過從 Security Lake 查詢資料擷取的日誌和事件。如需有關原始事件日誌的詳細資訊，您可以檢視 Amazon Athena 中顯示的資料。](http://docs.aws.amazon.com/zh_tw/detective/latest/userguide/images/query-raw-log-vpc.png)

在**原始日誌預覽**資料表中，您可以檢視透過從 Security Lake 查詢資料擷取的日誌和事件。如需有關原始事件日誌的詳細資訊，您可以檢視 Amazon Athena 中顯示的資料。

您可以在查詢原始日誌資料表中**取消查詢請求**、**在 Amazon Athena 中查看結果**以及**下載結果**為逗號分隔值 (.csv) 設定檔。