Skip to content

Instantly share code, notes, and snippets.

@yudai09
Created June 22, 2016 09:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yudai09/0ead9dd0ec08217cc734c0569fd1de69 to your computer and use it in GitHub Desktop.
Save yudai09/0ead9dd0ec08217cc734c0569fd1de69 to your computer and use it in GitHub Desktop.
#!/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