Skip to content

Instantly share code, notes, and snippets.

@tkuchiki
Last active March 28, 2016 09:31
Show Gist options
  • Save tkuchiki/d247306ac8afbdf05e30 to your computer and use it in GitHub Desktop.
Save tkuchiki/d247306ac8afbdf05e30 to your computer and use it in GitHub Desktop.
<source>
type forward
port 24224
</source>
<match **>
type forward
<server>
host test-server
</server>
buffer_type file
buffer_path /path/to/buffer
flush_interval 1s
</match>
<source>
type forward
port 24224
</source>
<match **>
type forward
<server>
host test-server
</server>
<secondary>
type s3
aws_key_id xxxxxx
aws_sec_key yyyyyy
s3_bucket your_bucket
s3_region ap-northeast-1
s3_object_key_format %{path}.%{file_extension}
path nginx
buffer_path /path/to/s3_forward
time_slice_format %Y%m%d
time_slice_wait 5m
utc
</secondary>
buffer_type file
buffer_path /path/to/buffer
flush_interval 1s
retry_limit 5
max_retry_wait 10s
</match>

file buffer

$ echo '{"foo": "bar"}' | fluent-cat debug.test
$ ruby unpack.rb /path/to/forward.debug.test.xxx.log
[1459155557, {"foo"=>"bar"}]

s3 buffer

$ echo '{"foo": "bar"}' | fluent-cat debug.test
$ aws s3 cp s3://path/to/buffer/forward_debug.test.gz .
$ gunzip forward_debug.test.gz
$ ruby unpack.rb /path/to/forward.debug.test
[1459155737, {"foo"=>"bar"}]
require 'msgpack'
p MessagePack.unpack(File.open(ARGV[0]).read)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment