Skip to content

Instantly share code, notes, and snippets.

@rubendob
Last active April 12, 2018 10:01
Show Gist options
  • Save rubendob/2560f082369238fe4ef361a41ba3da0e to your computer and use it in GitHub Desktop.
Save rubendob/2560f082369238fe4ef361a41ba3da0e to your computer and use it in GitHub Desktop.
Local Fluentd to debug purposes - Ubuntu Xenial 16.04 TLS / fluent-plugin-kv-parser
sudo curl -L https://toolbelt.treasuredata.com/sh/install-ubuntu-xenial-td-agent2.sh | sh config
sudo /usr/sbin/td-agent-gem install fluent-plugin-kv-parser
(edit config file, do backup first)
sudo cp /etc/td-agent/td-agent.conf /etc/td-agent/td-agent.conf.backup
echo "
<source>
@type tcp
tag kv_log # required
port 20001 # optional. 5170 by default
bind 127.0.0.1 # optional. 0.0.0.0 by default
<parse>
@type kv
time_key my_time
types k1:integer,my_time:time
</parse>
</source>
<match kv_log>
@type stdout
</match>"
>> /etc/td-agent/td-agent.conf
sudo systemctl restart td-agent.service
echo "my_time=2014-12-31T00:00:00 k1=1234 k2=hello" | nc localhost 20001
cat /var/log/td-agent/td-agent.log
2018-04-12 11:51:41 +0200 [info]: #0 fluentd worker is now running worker=0
2014-12-31 00:00:00.000000000 +0100 kv_log: {"k1":1234,"k2":"hello"}
2014-12-31 00:00:00.000000000 +0100 kv_log: {"k1":1234,"k2":"hello"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment