Skip to content

Instantly share code, notes, and snippets.

@smarj
Forked from angrycub/check-debugs.sh.md
Created May 5, 2016 15:39
Show Gist options
  • Save smarj/d19e6fd4a045a530dd42da1beae0ad20 to your computer and use it in GitHub Desktop.
Save smarj/d19e6fd4a045a530dd42da1beae0ad20 to your computer and use it in GitHub Desktop.
Forever WIP preprocessor for a cluster's worth of Riak Debugs. Catches some of the faves and biggies
#! /bin/bash
echo Creating Combined console.log
for I in *-riak-debug; do NODE=${I//-riak-debug/}; echo " Processing ${NODE}..."; for J in $I/logs/platform_log_dir/console.lo*; do sed -n -e '/^2015/!{H;d;};/^2015/{x;s/\n/ /g;p;};${x;s/\n/ /g;p;}' $J | awk '!/^$/{print $1"T"$2,"'${NODE}'",$0}' | sed 's/\([^ ]*\) \([^ ]*\) \([^ ]*\) \([^ ]*\) \(.*\)/\1 \2 \5/' >> temp.log ; done; done; sort temp.log > combined_console.log;rm temp.log;
echo Creating Combined error.log
for I in *-riak-debug; do NODE=${I//-riak-debug/}; echo " Processing ${NODE}..."; for J in $I/logs/platform_log_dir/error.lo*; do sed -n -e '/^2015/!{H;d;};/^2015/{x;s/\n/ /g;p;};${x;s/\n/ /g;p;}' $J | awk '!/^$/{print $1"T"$2,"'${NODE}'",$0}' | sed 's/\([^ ]*\) \([^ ]*\) \([^ ]*\) \([^ ]*\) \(.*\)/\1 \2 \5/' >> temp.log ; done; done; sort temp.log > combined_error.log;rm temp.log;
echo Checking for LevelDB Compaction Errors
find . -name "LOG" -exec grep -l 'Compaction error' {} \;
echo Checking for LevelDB Stalls
find . -name "LOG" -exec grep -l 'waiting' {} \; | wc -l
echo Fetching Non-Zero Swappiness Information
grep -s -H 'swappiness' */commands/sysctl_linux | grep -v "vm.swappiness = 0" | awk '{print $0}'
grep -s -H 'swappiness' */commands/sysctl | grep -v "vm.swappiness = 0" | awk '{print $0}'
echo Looking for Nodes and Drives set to CFQ
grep -B1 '\[cfq\]' */commands/schedulers | grep -v '\[cfq\]' | grep -v "\-\-" | awk -F"-" '{print " ",$1," ",$4}' | sort
echo Counting Large Objects in Logfiles.
grep "Large Object" combined_console.log | wc -l
echo Counting Large Objects in Logfiles.
grep "Too many siblings" combined_console.log | wc -l
echo Removing Spammy Log Events.
grep -v "Too many siblings" combined_console.log |
grep -v "Unrecognized message" |
grep -v "Heartbeat is misconfigured" |
grep -v "monitor long_schedule" |
grep -v "{shutdown,max_concurrency}"|
grep -v "There's no NAT mapping" > combined_console.log.nospam
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment