Skip to content

Instantly share code, notes, and snippets.

@redbaron
Last active March 30, 2016 16:22
Show Gist options
  • Save redbaron/645f9f8ace77d04aabd9 to your computer and use it in GitHub Desktop.
Save redbaron/645f9f8ace77d04aabd9 to your computer and use it in GitHub Desktop.
<source>
@type tail
path /fluentd/log/main.log
format none
tag x
</source>
<match **>
@type file
path /fluentd/log/output.log
</match>
#!/bin/bash
set -e
mkdir -p log
rm -rf log/*
gen_x_lines() {
N=$1; shift
yes | head -n $N > log/main.log
}
ID=$(sudo docker run -d -v $PWD/fluent.conf:/fluentd/etc/fluent.conf -v $PWD/log:/fluentd/log fluent/fluentd:latest)
trap "sudo docker stop $ID >/dev/null; sudo docker rm $ID >/dev/null;" EXIT
echo Started container $ID
sleep 1
C=1;
LIMIT=10
echo Generating logs
while gen_x_lines 10000 && ((C++ < $LIMIT)) ; do sleep 2; mv log/main.log log/main.log.${C} ; done
echo Comparing results
GOAL=$(wc -l log/main.log*|awk '/total/ {print $1}')
echo original output: $GOAL
FNUM=
I=$(wc -l log/output.log* |awk '/total/ {print $1}')
while (( FNUM != I )); do
echo fluent produced: $I; FNUM="$I"
sleep 1
I=$(wc -l log/output.log* |awk '/total/ {print $1}')
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment