This is a short training for introduce Pi to use fluentd to collect data and use Google Cloud Logging and BigQuery as backend and then use Apps Script and Google Sheet as presentation layer.
6. Fluentd
● Easy and fast
● Message delivery for at
most once, at least
once, exactly once
7. BigQuery
● TB Level data analysis
● Fast mining tool
● SQL like interface
● Multi-dataset join support
● Cheap & Pay by Use
Google BigQuery - Big data with SQL like query feature, but fast...
9. Architecture
● BigQuery: Data Warehouse and
support query and analysis
● Cloud Logging: Log gateway
and easy to transfer to one or
multi destination with guarantee
● Fluentd: Device layer gateway
and support multi source for
user to extend http(s) input
tcp/udp input
forward / secure forward
other inputs
● Customize schema
● Co-relation
● Higher quota and
performance
● Web console
● Export available for BQ,
GCS, Pub/Sub
● Configure input source
13. Configure
# /etc/google-fluentd/google-fluentd.conf
<source>
type http
port 9880
</source>
<source>
@type forward
port 24224
</source>
<filter *.**>
@type stdout
</filter>
# Do not collect fluentd's own logs to avoid infinite loops.
<match fluent.**>
type null
</match>
# Configure all sources to output to Google Cloud Logging
<match *.**>
type google_cloud
# Set the chunk limit conservatively to avoid exceeding the limit
# of 10MB per write request.
buffer_chunk_limit 2M
flush_interval 5s
# Never wait longer than 5 minutes between retries.
max_retry_wait 300
# Disable the limit on the number of retries (retry forever).
disable_retry_limit
# Use multiple threads for processing.
num_threads 8
</match>
Set config to open fluentd forward
and also screen output for debug..
14. Test run & watch log...
# service google-fluentd start
# tail -f /var/log/google-fluentd/google-fluentd.log
2016-09-02 09:46:44 +0000 hddusage.simon-project.a_54ERXdr4inKCGiAAAA:
{"catg":"hddusage","ctime":null,"size":null,"used":null,"avail":null,"use":null,"linker_devid":"simon-project.a_54ERXdr4inKCGiAAAA"}
2016-09-02 09:46:44 +0000 hddusage.simon-project.a_54ERXdr4inKCGiAAAA:
{"catg":"hddusage","ctime":null,"size":null,"used":null,"avail":null,"use":null,"linker_devid":"simon-project.a_54ERXdr4inKCGiAAAA"}
2016-09-02 09:46:44 +0000 hddusage.simon-project.a_54ERXdr4inKCGiAAAA:
{"catg":"hddusage","ctime":null,"size":null,"used":null,"avail":null,"use":null,"linker_devid":"simon-project.a_54ERXdr4inKCGiAAAA"}
….(skip)