Automation Suite
2022.4
バナーの背景画像
Automation Suite インストール ガイド
最終更新日 2024年4月24日

Splunk を設定する

注:
  • このセクションでは、POD ログのエクスポートについて説明します。ロボット ログをエクスポートする方法については、『Orchestrator ガイド』の「ログについて」をご覧ください。

  • Splunk は外部ツールであり、UiPath から Splunk の設定内容について指示することはできません。HTTP イベント コレクターの詳細については、Splunk の公式ドキュメントをご覧ください。

Splunk-Fluentd スタックは、ログ データの検索、分析、可視化を可能にする一元化されたログ ソリューションです。Fluentd はログを収集して Splunk に送信します。Splunk はログを取得し、データの可視化や分析を可能にします。

トークンを含むシークレットを作成する

Splunk の HTTP イベント コレクター トークンを使用してクラスター内にシークレットを作成するには、次のコマンドを実行します。

kubectl -n cattle-logging-system create secret generic splunk-hec-token --from-literal=splunk_hec_token=<splunk_hec_token>kubectl -n cattle-logging-system create secret generic splunk-hec-token --from-literal=splunk_hec_token=<splunk_hec_token>

Splunk への ClusterOutput

Splunk に ClusterOutput するには、次のコマンドを実行します。次の属性を、Splunk 構成で使用されている属性に置き換えます。

kubectl -n cattle-logging-system apply -f - <<"EOF"
apiVersion: logging.banzaicloud.io/v1beta1
kind: ClusterOutput
metadata:
  name: splunk-output
spec:
  splunkHec:
    buffer:
      tags: '[]'
      timekey: <splunk_hec_timekey>
      timekey_use_utc: true
      timekey_wait: 10s
      type: file
    hec_host: <splunk_hec_host>
    hec_port: <splunk_hec_port>
    hec_token:
      valueFrom:
        secretKeyRef:
          key: <secret_key>
          name: splunk-hec-token
    index: <splunk_hec_index>
    insecure_ssl: true
    protocol: <splunk_hec_protocol>
    source: <splunk_hec_source>
    sourcetype: <splunk_hec_source_type>
EOFkubectl -n cattle-logging-system apply -f - <<"EOF"
apiVersion: logging.banzaicloud.io/v1beta1
kind: ClusterOutput
metadata:
  name: splunk-output
spec:
  splunkHec:
    buffer:
      tags: '[]'
      timekey: <splunk_hec_timekey>
      timekey_use_utc: true
      timekey_wait: 10s
      type: file
    hec_host: <splunk_hec_host>
    hec_port: <splunk_hec_port>
    hec_token:
      valueFrom:
        secretKeyRef:
          key: <secret_key>
          name: splunk-hec-token
    index: <splunk_hec_index>
    insecure_ssl: true
    protocol: <splunk_hec_protocol>
    source: <splunk_hec_source>
    sourcetype: <splunk_hec_source_type>
EOF

属性

説明

splunk_hec_host

Splunk インスタンスのネットワーク ホストです。

splunk_hec_port

クライアント通信用の Splunk ポートです。

secret_key

Splunk トークンを含むシークレット キーです。

splunk_hec_timekey 値、次の属性内: splunkHec.buffer

出力頻度、つまりログをプッシュする頻度です。

protocol

URL プロトコルです。有効な値は http および https です。

splunk_hec_index

イベントのインデックス作成に使用する Splunk インデックスの識別子です。

splunk_hec_source

イベントのソース フィールドです。

splunk_hec_source_type

イベントのソースの種類のフィールドです。

FluentD 内の ClusterFlow

Fluentd で ClusterFlow するには、次のコマンドを実行します。

kubectl -n cattle-logging-system apply -f - <<"EOF"
apiVersion: logging.banzaicloud.io/v1beta1
kind: ClusterFlow
metadata:
  name: splunk-flow
  namespace: cattle-logging-system
spec:
  filters:
  - tag_normaliser:
      format: ${namespace_name}/${pod_name}.${container_name}
  globalOutputRefs:
  - splunk-output
  match:
  - select:
      container_names:
      - istio-proxy
      namespaces:
      - istio-system
  - exclude:
      container_names:
      - istio-proxy
      - istio-init
      - aicenter-hit-count-update
      - istio-configure-executor
      - on-prem-tenant-license-update
      - curl
      - recovery
      - aicenter-oob-scheduler
      - cert-trustor
  - exclude:
      namespaces:
      - fleet-system
      - cattle-gatekeeper-system
      - default
  - exclude:
      labels:
        app: csi-snapshotter
  - exclude:
      labels:
        longhorn.io/job-task: backup
  - exclude:
      labels:
        app: csi-resizer
  - select: {}
EOFkubectl -n cattle-logging-system apply -f - <<"EOF"
apiVersion: logging.banzaicloud.io/v1beta1
kind: ClusterFlow
metadata:
  name: splunk-flow
  namespace: cattle-logging-system
spec:
  filters:
  - tag_normaliser:
      format: ${namespace_name}/${pod_name}.${container_name}
  globalOutputRefs:
  - splunk-output
  match:
  - select:
      container_names:
      - istio-proxy
      namespaces:
      - istio-system
  - exclude:
      container_names:
      - istio-proxy
      - istio-init
      - aicenter-hit-count-update
      - istio-configure-executor
      - on-prem-tenant-license-update
      - curl
      - recovery
      - aicenter-oob-scheduler
      - cert-trustor
  - exclude:
      namespaces:
      - fleet-system
      - cattle-gatekeeper-system
      - default
  - exclude:
      labels:
        app: csi-snapshotter
  - exclude:
      labels:
        longhorn.io/job-task: backup
  - exclude:
      labels:
        app: csi-resizer
  - select: {}
EOF
注: クラスターのログが ClusterOutput に収集、記録されます。

Splunk を構成する

Splunk を構成するには、次の手順に従います。

  1. 上部のナビゲーション バーの [設定] をクリックし、[インデックス] を選択します。


  2. [新規インデックス] をクリックしてから、[保存] をクリックしてインデックスを作成します。




  3. 上部のナビゲーション バーの [設定] をクリックし、[データ入力] を選択します。


  4. [HTTP イベントコレクタ] をクリックします。


  5. [グローバル設定] をクリックして、新しいトークンの作成を有効化します。


  6. 有効化して、[グローバル設定] を保存します。


  7. [新規トークン] をクリックしてトークンを作成します。


  8. HTTP イベント コレクターの名前を入力し、[次へ] をクリックします。


  9. [新規] をクリックして、ソース タイプの詳細を入力します。


  10. 下にスクロールして、利用可能なインデックスのリストからインデックスを選択し、上部のナビゲーション バーで [次へ] をクリックします。


  11. データを検証して、[実行] をクリックします。


  12. 作成されたら、トークン IDインデックスソースソース タイプの詳細を取得します。これらは ClusterOutput を設定する際に必要になります。


Splunk で検索する

  1. [サーチとレポート] をクリックします。


  2. SourceIndexSourceType に基づいて検索します。




トラブルシューティング

何らかの理由でアプリケーション ログが Splunk にプッシュされない場合は、以下を試してください。

  1. Fluentd のログ レベルを debug に変更する
  2. Fluentd ポッドに以下のクエリを実行する

    kubectl patch loggings.logging.banzaicloud.io rancher-logging-root --type=json -p '[{"op":"add","path":"/spec/fluentd/logLevel","value":debug}]'
    kubectl -n cattle-logging-system exec -it sts/rancher-logging-root-fluentd cat /fluentd/log/outkubectl patch loggings.logging.banzaicloud.io rancher-logging-root --type=json -p '[{"op":"add","path":"/spec/fluentd/logLevel","value":debug}]'
    kubectl -n cattle-logging-system exec -it sts/rancher-logging-root-fluentd cat /fluentd/log/out
    注: Fluentd のログに、データが Splunk にプッシュされない原因が示されているはずです。
  3. 問題を修正したら、Fluentd のログ レベルを元に戻します。
    kubectl patch loggings.logging.banzaicloud.io rancher-logging-root --type=json -p '[{"op":"remove","path":"/spec/fluentd/logLevel"}]'kubectl patch loggings.logging.banzaicloud.io rancher-logging-root --type=json -p '[{"op":"remove","path":"/spec/fluentd/logLevel"}]'
    

Was this page helpful?

サポートを受ける
RPA について学ぶ - オートメーション コース
UiPath コミュニティ フォーラム
UiPath ロゴ (白)
信頼とセキュリティ
© 2005-2024 UiPath. All rights reserved.