- 概要
- 要件
- インストール
- インストール後
- 移行とアップグレード
- 監視とアラート機能
- クラスターの管理
- データベースのメンテナンスを実行する
- アプリケーション ログを Splunk に転送する
- 製品固有の設定
- トラブルシューティング
アプリケーション ログを 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_host | Splunk インスタンスのネットワーク ホストです。通常は、Splunk の IP アドレスまたは FQDN です。 |
splunk_hec_port | クライアント通信用の Splunk ポートです。通常、このポートは Splunk のダッシュボードを起動するポートとは異なります。Splunk で一般的に使われる HEC ポートは 8088 です。 |
secret_key | Splunk トークンのシークレット キーです。これは前の手順で作成したシークレットのキーの名前で、ここに Splunk HEC トークンが保持されています。 提示されたマニフェストには、既にキー splunk_hec_token が含まれています。シークレットを作成するコマンドを変更していない場合、この値を変更する必要はありません。 |
splunk_hec_timekey 値、次の属性内: splunkHec.buffer | 出力頻度、つまりログをプッシュする頻度です。30 秒 (30s) の間隔を使用することをお勧めします。 |
protocol | URL プロトコルです。有効な値は http および https です。Splunk で SSL 通信を有効化している場合は、HTTPS プロトコルを使用する必要があります。 |
splunk_hec_index | Splunk インデックスの識別子です。イベントのインデックス作成に使用します。 |
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 で検索する
-
[検索とレポート] を選択します。
-
Source、Index、SourceType に基づいて検索します。
トラブルシューティング
何らかの理由でアプリケーション ログが Splunk にプッシュされない場合は、以下を試してください。
-
Fluentd のログ レベルを debug に変更します。
-
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/outkubectl 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 にプッシュされない原因が示されている必要があります。
-
問題を修正したら、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}]'