UiPath Documentation
automation-suite
2023.4
false
EKS/AKS の Automation Suite のインストール ガイド
重要 :
このコンテンツの一部は機械翻訳によって処理されており、完全な翻訳を保証するものではありません。 新しいコンテンツの翻訳は、およそ 1 ~ 2 週間で公開されます。

アプリケーション ログを Splunk に転送する

注:
  • This section covers exporting POD logs. For exporting robot logs, see Ochestrator - About Logs.
  • Splunk は外部ツールであり、UiPath® から Splunk の設定内容について指示することはできません。HTTP イベント コレクターについて詳しくは、Splunk の公式ドキュメントをご覧ください。

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

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

Splunk の UI で生成した HTTP イベント コレクター (HEC) トークンを使用して Kubernetes シークレットを作成します。このトークンは、Automation Suite と Splunk 間の認証に使用されます。

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

Splunk への ClusterOutput​

ClusterOutput でログの送信先を定義します。また、構成と認証の詳細も記述します。

To configure the ClusterOutput for Splunk, run the following command:

kubectl -n logging 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: splunk_hec_token
          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
kubectl -n logging 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: splunk_hec_token
          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 構成で使用されている対応する値に置き換えます。詳しくは、以下の表をご覧ください。

属性説明
splunk_hec_hostSplunk インスタンスのネットワーク ホストです。通常は、Splunk の IP アドレスまたは FQDN です。
splunk_hec_portクライアント通信用の Splunk ポートです。通常、このポートは Splunk のダッシュボードを起動するポートとは異なります。Splunk で一般的に使われる HEC ポートは 8088 です。
secret_keySplunk トークンのシークレット キーです。これは前の手順で作成したシークレットのキーの名前で、ここに Splunk HEC トークンが保持されています。

提示されたマニフェストには、既にキー splunk_hec_token が含まれています。シークレットを作成するコマンドを変更していない場合、この値を変更する必要はありません。
splunk_hec_timekey 値、次の属性内: splunkHec.buffer出力頻度、つまりログをプッシュする頻度です。30 秒 (30s) の間隔を使用することをお勧めします。
protocolURL プロトコルです。有効な値は http および https です。Splunk で SSL 通信を有効化している場合は、HTTPS プロトコルを使用する必要があります。
splunk_hec_indexSplunk インデックスの識別子です。イベントのインデックス作成に使用します。
splunk_hec_sourceイベントのソース フィールドです。
splunk_hec_source_typeイベントのソースの種類のフィールドです。
注:

Splunk のログを環境の種類 (開発、テストなど) でフィルター処理するには、 source 属性を使用します。

次の例は、このページで示す構成を基にしています。

FluentD 内の ClusterFlow​

ClusterFlow を使用して、以下を定義します。

  • 収集およびフィルター処理するログ
  • ログの送信先の ClusterOutput です。

To configure ClusterFlow in Fluentd, run the following command:

kubectl -n logging apply -f - <<"EOF"
apiVersion: logging.banzaicloud.io/v1beta1
kind: ClusterFlow
metadata:
  name: splunk-flow
  namespace: logging
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:
      - default
  - exclude:
      labels:
        app: csi-snapshotter
  - exclude:
      labels:
        longhorn.io/job-task: backup
  - exclude:
      labels:
        app: csi-resizer
  - select: {}
EOF
kubectl -n logging apply -f - <<"EOF"
apiVersion: logging.banzaicloud.io/v1beta1
kind: ClusterFlow
metadata:
  name: splunk-flow
  namespace: logging
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:
      - default
  - exclude:
      labels:
        app: csi-snapshotter
  - exclude:
      labels:
        longhorn.io/job-task: backup
  - exclude:
      labels:
        app: csi-resizer
  - select: {}
EOF

Splunk で検索する​

  1. [検索とレポート] を選択します。

  2. Source、Index、SourceType に基づいて検索します。

トラブルシューティング​

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

  1. Fluentd のログ レベルを debug に変更します。

  2. Fluentd ポッドに以下のクエリを実行する

    kubectl patch logging -n logging  logging-operator-logging  --type=json -p '[{"op":"add","path":"/spec/fluentd/logLevel","value":debug}]'
    kubectl -n logging exec -it sts/logging-operator-logging-fluentd cat /fluentd/log/out
    kubectl patch logging -n logging  logging-operator-logging  --type=json -p '[{"op":"add","path":"/spec/fluentd/logLevel","value":debug}]'
    kubectl -n logging exec -it sts/logging-operator-logging-fluentd cat /fluentd/log/out
    
    注:

    Fluentd ログには、データが Splunk にプッシュされない原因が示されている必要があります。

  3. 問題を修正したら、Fluentd のログ レベルを元に戻します。

    kubectl patch logging -n logging  logging-operator-logging  --type=json -p '[{"op":"remove","path":"/spec/fluentd/logLevel","value":debug}]'
    kubectl patch logging -n logging  logging-operator-logging  --type=json -p '[{"op":"remove","path":"/spec/fluentd/logLevel","value":debug}]'
    

このページは役に立ちましたか?

接続

ヘルプ リソース サポート

学習する UiPath アカデミー

質問する UiPath フォーラム

最新情報を取得