タイトル:Fluentbit のインストール
Fluentbit をインストールの際には、以下の手順が有用です。
helm ベースでのインストール
- helm チャートはプラグインで利用可能です。
テストの際には、以下のコマンドを使用します。
"https://artifacts-observability.sixthsense.rakuten.com/api/v4/projects/33/packages/generic/sixthsense-fluentbit-agent/1.0.0/fluentbit_helm.tgz"
- ss リポジトリの設定を追加します。
kubectl create secret docker-registry regcred --docker-server=gitlab-registry.34.120.183.186.sslip.io --docker-username=<token-name> --docker-password=<token>
- チャートをクリーンインストールします。
helm uninstall ssfluentd
helm install -f overrides.yaml ssfluentd https://artifacts-observability.sixthsense.rakuten.com/api/v4/projects/33/packages/generic/sixthsense-fluentbit-agent/1.0.0/fluentbit_helm.tgz
- 以下のファイルで上書き可能なパラメータはこの通りです。
overrides.yaml
image:
repository: asia-south1-docker.pkg.dev/sixthsense-pre-prod/sixthsense-fluentd-gcp/ssbit
pullPolicy: IfNotPresent
# Overrides the image tag whose default is the chart appVersion.
tag: 337bd8eb
configMap:
match:
apiKey: <<to get got from dashboard settings page>>
baseUri: https://http-collector-observability.sixthsense.rakuten.com/log/v1/log
serviceName: <<name of the agent - user defined>>
source:
path: /var/log/pods/*/*/*.log
posDb: /var/log/fluentd-json.log.db
excludePath: /var/log/pods/json*
service:
logLevel: debug
namespace: <<logging namespace>>
- 独自のパラメータを設定します。
独自のファイルを書くことで、設定ファイルの値を上書きすることができます。
helm uninstall ssfluentd
helm install ssfluentd https://artifacts-observability.sixthsense.rakuten.com/api/v4/projects/33/packages/generic/sixthsense-fluentbit-agent/1.0.0/fluentbit_helm.tgz -f overrides.yaml
Linux 環境へのインストール
Flutentbit を使用開始するための詳細は Flutentbitを使い始める を参照ください。
プラグインのインストール
以下のコマンドでプラグインファイルをダウンロードします。
curl -vvv https://atrifactory.url.rakuten.com
以下のファイルを使用してプラグインの設定を行う
plugins.conf
[PLUGINS]
Path /fluent-bit/bin/out_ssfb.so
parsers.conf
[PARSER]
Name json
Format json
fluentbit.conf
[SERVICE]
Flush 1
Daemon off
Log_Level INFO
storage.checksum off
storage.path /var/log/flb-storage/
storage.backlog.mem_limit 20M
storage.metrics On
Plugins_File plugins.conf
parsers_file parsers.conf
HTTP_Server On
HTTP_Listen 0.0.0.0
HTTP_PORT 2020
[INPUT]
Name tail
Path {{ .Values.configMap.source.path }}
Tag raw.*
DB {{ .Values.configMap.source.posDb }}
Exclude_Path {{ .Values.configMap.source.excludePath }}
Path_Key log_name
Parser json
storage.type filesystem
Refresh_Interval 1
Rotate_Wait 15
Inotify_Watcher false
[FILTER]
Name record_modifier
Match raw.*
Record logType raw
[FILTER]
Name record_modifier
Match json.*
Record logType json
[OUTPUT]
name sixthsense
match *
tls true
apiKey {{ .Values.configMap.match.apiKey }}
logType raw
Endpoint {{ .Values.configMap.match.baseUri }}
serviceName {{ .Values.configMap.match.serviceName }}
Streaming true
- {{ .Values.configMap.source.path }}= を監視するパスに置き換えます。
note
ワイルドカードもサポートされています。
- {{ .Values.configMap.source.posDb }} をデータベースの場所に置き換えます。
- {{ .Values.configMap.source.excludePath }} を除外すべきパスに置き換えます。
設定例
[INPUT]
Name tail
Path /var/log/message*
Tag raw.*
DB /var/log/logs.db
Exclude_Path /var/log/system
Path_Key log_name
Parser json
storage.type filesystem
Refresh_Interval 1
Rotate_Wait 15
Inotify_Watcher false
{{ .Values.configMap.match.apiKey }} を指定します。この値は SixthSense ポータルの設定ページから取得可能です。詳細は アクセストークンへのアクセス を参照ください。
{{ .Values.configMap.match.baseUri }} ベース URI の値です。
- {{ .Values.configMap.match.serviceName }} ベースURIの値です。ダッシュボードのUIに表示される名称です。
設定例
[OUTPUT]
name sixthsense
match *
tls true
apiKey eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ0ZWFtSWQiOiIxOGZhMDJmMS1iNjc1LTQ1MmQtYjllYy0yN2ZhYzdlZWM5MzUiLCJiaWxsaW5nX2lkIjoiYjVjNjVkMDgtMTVhYi00NDkwLTliZDMtM2FiZDc3ODZkN2YxIiwiaWF0IjoxNjIwMzY2NDgyLCJhdWQiOiJvYXAiLCJpc3MiOiJzaXh0aC1zZW5zLWF1dGgifQ.5U4Tlh8Abf25Wa-SJaf4KQHnNz8C-S35hG7ZG5PIHo8
logType raw
Endpoint https://http-collector-observability.sixthsense.rakuten.com/log/v1/log
serviceName demo_service
Streaming true