- 追加された行はこの色です。
- 削除された行はこの色です。
#author("2020-03-05T23:46:47+00:00","default:wikiadmin","wikiadmin")
#contents
-fluentdのバッチデータロード版
*インストール [#v01a7ae5]
jarファイルに実行権限をつけるのみ。公式サイトの通りにやると楽だが、curlがエラーとなってしまったので、手動でダウンロードした
curl --create-dirs -o ~/.embulk/bin/embulk -L "https://dl.embulk.org/embulk-latest.jar"
chmod +x ~/.embulk/bin/embulk
echo 'export PATH="$HOME/.embulk/bin:$PATH"' >> ~/.bashrc
source ~/.bashrc
**plugin [#ta36a7cc]
-一覧表示
embulk gem list
-各種プラグインインストール
embulk gem install embulk-output-elasticsearch
embulk gem install
*Elasticsearchへの連携 [#h7654bca]
http://qiita.com/handa/items/6ba0bc0678b0be95a1be
*設定ファイル [#ucac0ae4]
**fluentdのApacheログをS3にためて、それをElasticSearchに流す設定 [#l84feb6b]
in:
type: s3
bucket: バケット名
path_prefix:
endpoint: s3-ap-northeast-1.amazonaws.com
access_key_id:
secret_access_key:
decoders:
- {type: gzip}
parser:
type: json
root: $.Records
schema:
- {name: host, type: string}
- {name: user, type: string}
- {name: method, type: string}
- {name: path, type: string}
- {name: code, type: integer}
- {name: size, type: integer}
- {name: referer, type: string}
- {name: agent, type: string}
out:
type: elasticsearch
cluster_name:
nodes:
- {host: "localhost", port: 9300}
index: logstash-2016.06.04
index_type: apache
cluster_nameを間違えると通信ができてもNo Node Available Exceptionが出てしまうので注意。
**プラグインインストール [#h258a185]
embulk gem install embulk-input-mysql
embulk gem install embulk-output-elasticsearch
**実行 [#g0ff0d95]
embulk preview config.yml
embulk run config.yml
JSONのパースでエラー!guessコマンドを利用しても同様。クソですか?
td-agentの形式に対応していないというオチ。別のプラグインを入れる。
ようやくパースに成功したと思ったら、
「None of the configured nodes are available」だとcluster_nameを設定していないのが原因だった。環境変数が使えないという問題はあったものの素のElasticsearchには投入成功。ポートは9300じゃないとだめ
out:
type: elasticsearch
cluster_name: "elasticsearch"
nodes:
- {host: "IPV4 ADDRESS", port: 9300}
index: logstash-2016.06.09
index_type: apache
**ElasticSearchServiceとの連携 [#raf458a9]
だめっぽい
http://stackoverflow.com/questions/33412635/how-to-connect-to-aws-elasticsearch
*設定ファイルに変数を使う [#c47ccb2f]
liquidという拡張子にすると環境変数を展開してくれる。
#counter