Skip to content

Instantly share code, notes, and snippets.

@sw-samuraj
Last active December 18, 2020 18:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sw-samuraj/e74710a1722e2f676de3eb90ad4e8d84 to your computer and use it in GitHub Desktop.
Save sw-samuraj/e74710a1722e2f676de3eb90ad4e8d84 to your computer and use it in GitHub Desktop.
## File input
<source>
@type tail
path /tmp/fluentd/*/cell.log
pos_file /tmp/fluentd/cell.log.pos
tag cloudsql.cell
read_from_head true
<parse>
@type json
</parse>
</source>
## Filter
<filter cloudsql.cell>
@type record_transformer
enable_ruby
<record>
msg ${record["msg"].encode("UTF-8", invalid: :replace, replace: "__NON_ASCII_CHAR__")}
timestamp ${record["ts"]}
</record>
</filter>
## Elasticsearch
<match cloudsql.cell>
@type elasticsearch
host localhost
port 9200
index_name fluentd.${tag}
<buffer>
flush_interval 10s
</buffer>
</match>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment