Skip to content

Instantly share code, notes, and snippets.

@wshihadeh
Created January 19, 2020 18:26
Show Gist options
  • Save wshihadeh/34b47e4c4cac3966caaa6c7d64228500 to your computer and use it in GitHub Desktop.
Save wshihadeh/34b47e4c4cac3966caaa6c7d64228500 to your computer and use it in GitHub Desktop.
FluentD Parse configs
<match row.busylogbox.**>
@type record_reformer
tag busylogbox.${tag_suffix[2]}
renew_record false
enable_ruby true
<record>
request_time ${record['log'].scan(/(?<param>^[^ ]+ [^ ]+)/).flatten.compact[0]}
request_id ${record['log'].scan(/(?<param>[^ ]+) OS/).flatten.compact[0]}
os ${record['log'].scan(/OS=(?<param>[^ ]+)/).flatten.compact[0]}
architecture ${record['log'].scan(/AR=(?<param>[^ ]+)/).flatten.compact[0]}
cpu ${record['log'].scan(/CPU=\((?<param>[^ ]+)\)/).flatten.compact[0]}
usr ${record['log'].scan(/USR=(?<param>[^ ]+)/).flatten.compact[0]}
nice ${record['log'].scan(/NICE=(?<param>[^ ]+)/).flatten.compact[0]}
sys ${record['log'].scan(/SYS=(?<param>[^ ]+)/).flatten.compact[0]}
iowait ${record['log'].scan(/IOWAIT=(?<param>[^ ]+)/).flatten.compact[0]}
irq ${record['log'].scan(/IRQ=(?<param>[^ ]+)/).flatten.compact[0]}
soft ${record['log'].scan(/SOFT=(?<param>[^ ]+)/).flatten.compact[0]}
soft ${record['log'].scan(/STEAL=(?<param>[^ ]+)/).flatten.compact[0]}
soft ${record['log'].scan(/GUEST=(?<param>[^ ]+)/).flatten.compact[0]}
soft ${record['log'].scan(/IDLE=(?<param>[^ ]+)/).flatten.compact[0]}
message ${record['log'].to_s.strip}
log ''
</record>
</match>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment