Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
#!/bin/sh
# pipeで受け取った標準入力をfluent-catで送り出す
tag=$1
if [ $# -ne 1 ]; then
echo "$0: specify tag name"
exit 0
fi
if [ -p /dev/stdin ]; then
cat -
else
echo $@
fi | xargs -I{} echo '{"json": "' {} '"}' | /usr/lib64/fluent/ruby/bin/fluent-cat $tag
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment