通过使用Fluentd将传感器数据发送到Google Cloud Platform上的Elasticsearch进行可视化
首先
在以前的文章中,我们将使用RaspberryPi收集的传感器数据发送到部署在さくらVPS上的Elasticsearch,并在Kibana中进行可视化。这次为了学习的目的,我们将更改配置以将数据发送到Google Cloud Platform(GCP)。
-
- 関連記事
センサデータを fluentd 経由で Amazon Elasticsearch Service に送信して可視化
2. 服务器端的设置(GCP)
在Cloud Launcher上搜索并部署解决方案。
我会寻找一个包含 Elasticsearch 和 Kibana 的套装。
由于「ELK Certified by Bitnami」看起来不错,所以我决定将其部署到虚拟机上。

初始设定界面。
我降低了机器的规格和硬盘尺寸。

点击部署按钮后,部署将开始。
在部署管理器中查看信息

在VPC网络中添加设置到防火墙规则中。

3个传感器端的设置(树莓派)
前提条件
这次我们将对以前的文章进行更改,以前文章的状态是前提。
安装插件
- fluentd から Elasticsearch に直接格納するためのプラグインをインストールします
sudo fluent-gem install fluent-plugin-elasticsearch
请描述一下 fluentd 的配置。
- fluentd の設定ファイルを編集して、データの送信先を変更して、fluentd を再起動します
<source>
@type tail
format json
path /home/pi/myroom.log
pos_file /home/pi/myroom.log.pos
tag log.myroom
</source>
<match log.myroom>
@type copy
<store>
@type elasticsearch
type_name myroom
logstash_format true
logstash_prefix myroom
reload_connections false
hosts http://XXX.XXX.XXX.XXX:9200
</store>
</match>
4. 确认
