Skip to content

Instantly share code, notes, and snippets.

@holysugar
Created July 24, 2013 12:28
Show Gist options
  • Select an option

  • Save holysugar/6070096 to your computer and use it in GitHub Desktop.

Select an option

Save holysugar/6070096 to your computer and use it in GitHub Desktop.
out_exec_filter で jq (内容は適当)
<source>
type forward
</source>
<match json.**>
type exec_filter
tag debug.json
command jq '{a, b, c, x: .other.x, nextfoo: .other.next.foo, time}'
in_format json
out_format json
time_key time
flush_interval 1s
</match>
<match **>
type stdout
</match>
require 'fluent-logger'
@logger = Fluent::Logger::FluentLogger.new('json')
def log
@logger.post("foo", {
a: rand(100), b: rand(100), c: rand(100),
time: Time.now.to_i,
other: {
x: rand(10), y: rand(10), z: rand(10),
next: { foo: rand(10) }
}
})
end
20.times do; puts Time.now; 10.times{ log }; sleep 0.5; end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment