

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

# 連接 Splunk
<a name="connecting-telemetry-sources-connecting-splunk"></a>

## 內建的單向整合
<a name="built-in-1-way-integration"></a>

目前， AWS DevOps Agent 支援具有內建單向整合的 Splunk 使用者，啟用下列項目：
+ **自動化調查觸發** - Splunk 事件可設定為透過 AWS DevOps 代理程式 Webhook 觸發 AWS DevOps 代理程式事件解決調查。
+ **遙測自我檢查** - AWS DevOps 代理程式可以透過每個供應商的遠端 MCP 伺服器調查問題，來自我檢查 Splunk 遙測。

## 先決條件
<a name="prerequisites"></a>

### 取得 Splunk API 字符
<a name="getting-a-splunk-api-token"></a>

您需要 MCP URL 和字符才能連接 Splunk。

### Splunk 管理員步驟
<a name="splunk-administrator-steps"></a>

您的 Splunk 管理員需要執行下列步驟：
+ 啟用 [REST API 存取 ](https://docs.splunk.com/Documentation/SplunkCloud/latest/RESTTUT/RESTandCloud)
+ 在 部署上[啟用權杖身分驗證](https://help.splunk.com/en/splunk-cloud-platform/administer/manage-users-and-security/9.2.2406/authenticate-into-the-splunk-platform-with-tokens/enable-or-disable-token-authentication)。
+ 建立新的角色 'mcp\$1user'，新角色不需要有任何功能。
+ 會將角色 'mcp\$1user' 指派給部署上獲授權使用 MCP 伺服器的任何使用者。
+ 如果使用者沒有建立字符本身的許可，請為對象為 'mcp' 的授權使用者建立字符，並設定適當的過期時間。

### Splunk 使用者步驟
<a name="splunk-user-steps"></a>

Splunk 使用者需要執行下列步驟：
+ 向 Splunk 管理員取得適當的權杖，如果他們具有 許可，則自行建立權杖。字符的對象必須是 'mcp'。

## 上線
<a name="onboarding"></a>

### 步驟 1：連線
<a name="step-1-connect"></a>

使用帳戶存取憑證建立與 Splunk 遠端 MCP 端點的連線

#### Configuration
<a name="configuration"></a>

1. 前往**能力提供者頁面 **（可從側邊導覽存取）

1. 在**遙測**下的**可用**供應商區段中尋找 **Splunk**，然後按一下**註冊**

1. 輸入您的 Splunk MCP 伺服器詳細資訊：
   + **伺服器名稱** - 唯一識別符 （例如 my-splunk-server)
   + **端點 URL** - Splunk MCP 伺服器端點：

`https://<YOUR_SPLUNK_DEPLOYMENT_NAME>.api.scs.splunk.com/<YOUR_SPLUNK_DEPLOYMENT_NAME>/mcp/v1/`
+ **描述** - 選用的伺服器描述
+ **權杖名稱** - 用於身分驗證的承載權杖名稱： `my-splunk-token`
+ **權杖值** 身分驗證的承載權杖值

### 步驟 2：啟用
<a name="step-2-enable"></a>

在特定客服人員空間中啟用 Splunk，並設定適當的範圍

#### Configuration
<a name="configuration"></a>

1. 從客服人員空間頁面，選取客服人員空間並按下檢視詳細資訊 （如果您尚未建立客服人員空間，請參閱 [建立 代理程式空間](getting-started-with-aws-devops-agent-creating-an-agent-space.md))

1. 選取功能索引標籤

1. 向下捲動至遙測區段

1. 按下新增

1. 選取 Splunk

1. 下一頁

1. 檢閱並按下儲存

1. 複製 Webhook URL 和 API 金鑰

### 步驟 3：設定 Webhook
<a name="step-3-configure-webhooks"></a>

使用 Webhook URL 和 API 金鑰，您可以設定 Splunk 傳送事件以觸發調查，例如從警示。

為了確保 DevOps 代理程式可以使用傳送的事件，請確定傳輸至 Webhook 的資料符合下列指定的資料結構描述。DevOps 代理程式可能會忽略不符合此結構描述的事件。

設定 方法和標頭

```
    method: "POST",
    headers: {
      "Content-Type": "application/json",
      "Authorization": "Bearer <Token>",
    },
```

以 JSON 字串傳送內文。

```
{
    eventType: 'incident';
    incidentId: string;
    action: 'created' | 'updated' | 'closed' | 'resolved';
    priority: "CRITICAL" | "HIGH" | "MEDIUM" | "LOW" | "MINIMAL";
    title: string;
    description?: string;
    timestamp?: string;
    service?: string;
    // The original event generated by service is attached here.
    data?: object;
}
```

使用 Splunk [https://help.splunk.com/en/splunk-enterprise/alert-and-respond/alerting-manual/9.4/configure-alert-actions/use-a-webhook-alert-action](https://help.splunk.com/en/splunk-enterprise/alert-and-respond/alerting-manual/9.4/configure-alert-actions/use-a-webhook-alert-action) 傳送 Webhook （請注意，選取不授權，而是使用自訂標頭選項）

### 進一步了解：
<a name="learn-more"></a>
+ Splunk 的 MCP 伺服器文件：https：//[https://help.splunk.com/en/splunk-cloud-platform/mcp-server-for-splunk-platform/about-mcp-server-for-splunk-platform ](https://help.splunk.com/en/splunk-cloud-platform/mcp-server-for-splunk-platform/about-mcp-server-for-splunk-platform)
+ Splunk Cloud Platform REST API 的存取需求和限制：[https：//https://docs.splunk.com/Documentation/SplunkCloud/latest/RESTTUT/RESTandCloud ](https://docs.splunk.com/Documentation/SplunkCloud/latest/RESTTUT/RESTandCloud)
+ 在 Splunk Cloud Platform 中管理身分驗證字符：[https：//https://help.splunk.com/en/splunk-cloud-platform/administer/manage-users-and-security/9.3.2411/authenticate-into-the-splunk-platform-with-tokens/manage-or-delete-authentication-tokens ](https://help.splunk.com/en/splunk-cloud-platform/administer/manage-users-and-security/9.3.2411/authenticate-into-the-splunk-platform-with-tokens/manage-or-delete-authentication-tokens)
+ 使用 Splunk Web 建立和管理角色：[https：//https://docs.splunk.com/Documentation/SplunkCloud/latest/Security/Addandeditroles ](https://docs.splunk.com/Documentation/SplunkCloud/latest/Security/Addandeditroles)

## 移除
<a name="removal"></a>

遙測來源在客服人員空間層級和帳戶層級的兩個層級上連接。若要完全移除它，您必須先將其從使用它的所有代理程式空間中移除，然後才能取消註冊。

### 步驟 1：從客服人員空間移除
<a name="step-1-remove-from-agent-space"></a>

1. 從客服人員空間頁面，選取客服人員空間並按下檢視詳細資訊

1. 選取功能索引標籤

1. 向下捲動至遙測區段

1. 選取 Splunk

1. 按移除

### 步驟 2：從帳戶取消註冊
<a name="step-2-deregister-from-account"></a>

1. 前往**能力提供者頁面 **（可從側邊導覽存取）

1. 捲動至**目前註冊**的區段。

1. 檢查客服人員空間計數為零 （如果不是在其他客服人員空間中重複上述步驟 1) 

1. 按下 Splunk 旁的取消註冊