Skip to content

Instantly share code, notes, and snippets.

@jbadiapa
Last active August 27, 2018 12:20
Show Gist options
  • Save jbadiapa/7bbd5f749647224add8bd628ab8bf6e8 to your computer and use it in GitHub Desktop.
Save jbadiapa/7bbd5f749647224add8bd628ab8bf6e8 to your computer and use it in GitHub Desktop.
Tripleo Fluentd checker sh
### Check the yaml files on the undercloud
#Puppet
for file in `find /usr/share/openstack-tripleo-heat-templates/puppet -type f -name '*.yaml'`; do
ITER=`grep LoggingSource $file | wc -l`
if [ $ITER -lt 2 ]; then
echo $file
fi
done
### Check the yaml files on the undercloud
#docker
for file in `find /usr/share/openstack-tripleo-heat-templates/docker -type f -name '*.yaml'`; do
ITER=`grep LoggingSource $file | wc -l`
if [ $ITER -lt 2 ]; then
echo $file
fi
done
# Check whether fluentd is active
FLUENTD=`hiera -c /etc/puppet/hiera.yaml service_names | grep fluentd | wc -l`
if [ "$FLUENTD" -eq "0" ]; then
echo "Fluentd is not enabled"
exit 1
fi
#Files configured on fluentd that does not exits
grep path /var/lib/config-data/fluentd/etc/fluentd/config.d/100-* | awk '{print $2}' | xargs -i ls -l {}
#Existed files not created by containers that are not controller by fluentd
for file in `sudo find /var/log/ -type f | grep -v containers | grep -v \.1 | grep -v \.2`; do
grep $file /var/lib/config-data/fluentd/etc/fluentd/config.d/100* > /dev/null
RESULT="$?"
if [ "$RESULT" -eq "1" ]; then
echo $file" not controlled by fluentd"
fi
done
#Existed files that are not controlled by fluentd
for file in `find /var/log/containers/ -type f | grep -v \.1 | grep -v \.2`; do
grep $file /var/lib/config-data/fluentd/etc/fluentd/config.d/100* > /dev/null
RESULT="$?"
if [ "$RESULT" -eq "1" ]; then
echo $file" not controlled by fluentd"
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment