dubblebee
5/14/2018 - 9:54 AM

Check markLogic logs

Loops ot check how busy ML logs are

#Just looking into the 1am high loads on xstore boxes and have made a couple of loops that might be useful (or modifiable to make them useful) at some point – they do a line count for each hour of the last five days of the logs on the live xstore nodes, and output the results as a Jira-ready table:

#ErrorLog:
for i in {056..064} {156..164}; do ssh -qt xstore${i} 'echo -n "*$(hostname)*";echo;echo -n "||Date:||"; for t in {5..0}; do echo -n "$(date +%d-%m-%y --date="-${t} day")||";done;echo;for h in {00..23}; do echo -n "||${h}:00|";for t in {5..1}; do echo -n "$(cat /xstore/Logs/ErrorLog_${t}.txt| grep "$(declare -i day=$(date +%d)-${t};echo $(date +%Y-%m-)$day) ${h}" |wc -l)|";done;echo -n "$(cat /xstore/Logs/ErrorLog.txt | grep "$(date +%Y-%m-%d) ${h}" |wc -l)|";echo;done';echo;done

#AccessLog (prompts for port number, so you can check whichever app server you’re interested in):
read -p 'Port number of AccessLog: ' port; for i in {056..064} {156..164}; do ssh -qt xstore${i} 'echo -n "*$(hostname)*";echo;echo -n "||Date:||"; for t in {5..0}; do echo -n "$(date +%d-%m-%y --date="-${t} day")||";done;echo;for h in {00..23};  do echo -n "||${h}:00|"; for t in {5..1}; do echo -n "$(cat /xstore/Logs/$port_AccessLog_${t}.txt| grep "$(declare -i day=$(date +%d)-${t};echo ${day}/$(date +%b/%Y)):${h}" |wc -l)|"; done; echo -n "$(cat /xstore/Logs/${port}_AccessLog.txt | grep "$(date +%d/%b/%Y):${h}" |wc -l)|"; echo; done'; echo;done