インストール

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

embulk gem list
embulk gem install embulk-output-elasticsearch
embulk gem install 

Elasticsearchへの連携

http://qiita.com/handa/items/6ba0bc0678b0be95a1be

設定ファイル

fluentdのApacheログをS3にためて、それをElasticSearchに流す設定

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が出てしまうので注意。

プラグインインストール

embulk gem install embulk-input-mysql
embulk gem install embulk-output-elasticsearch

実行

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との連携

だめっぽい

http://stackoverflow.com/questions/33412635/how-to-connect-to-aws-elasticsearch

設定ファイルに変数を使う

liquidという拡張子にすると環境変数を展開してくれる。

Counter: 3452, today: 2, yesterday: 5

トップ   編集 凍結 差分 履歴 添付 複製 名前変更 リロード   新規 一覧 検索 最終更新   ヘルプ   最終更新のRSS
Last-modified: 2022-10-14 (金) 13:16:52