Advertisement
Guest User

Untitled

a guest
Apr 23rd, 2018
239
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.93 KB | None | 0 0
  1. set +x
  2. set -e
  3.  
  4.  
  5. echo ""
  6. echo "---------------------------------------------------------------------"
  7. echo "Generating Crash Report Dashboard"
  8. echo "---------------------------------------------------------------------"
  9. echo ""
  10.  
  11.  
  12.  
  13. REPORT_SERVER=$(cat servers.list | xargs)
  14. SUMMARY=""
  15.  
  16. # Check each subfolder for the logs
  17. for server in $REPORT_SERVER
  18. do
  19.  
  20. echo ""
  21. echo "---------------------------------------------------------------------"
  22. echo "Checking subfolder contents for $server"
  23. echo "---------------------------------------------------------------------"
  24. echo ""
  25.  
  26. for file in ./$server/*
  27. do
  28. # Only read .log files
  29. if [[ $file == *log ]]; then
  30. grep -hr -A2 --no-group-separator "Details:" ./$server/* | awk '!(NR%3)' > $server-summary.txt
  31. fi
  32. done
  33.  
  34. echo "Parsed errors for $server"
  35.  
  36. echo ""
  37. echo "---------------------------------------------------------------------"
  38. echo " Grouping related crash reports for $server"
  39. echo "---------------------------------------------------------------------"
  40. echo ""
  41.  
  42. echo "All errors for $server"
  43. errors=$(sort $server-summary.txt | uniq -c | sort -bgr)
  44.  
  45. echo "$errors"
  46. SUMMARY="{$SUMMARY\n{$server}\n{$errors}\n"
  47.  
  48. done
  49.  
  50. # Create a dashboard
  51. dashboard=$(cat <<EOF
  52. <html>
  53.  
  54. <head>
  55. <meta charset="utf-8">
  56. <title>V-DOCS Crash Reports - Dashboard</title>
  57.  
  58. <style>
  59. html {
  60. background: #6b6b6b;
  61. }
  62.  
  63. body {
  64. font: 13px/1.4 Arial, sans-serif;
  65. width: 980px;
  66. background: #fff;
  67. padding: 20px;
  68. margin: 20px auto;
  69. border-radius: 5px;
  70. box-shadow: 1px 3px 5px #060606;
  71. }
  72.  
  73. .sha {
  74. font-family: monospace;
  75. }
  76.  
  77. .date {
  78. font-weight: normal;
  79. font-size: 11px;
  80. display: block;
  81. }
  82. </style>
  83. </head>
  84.  
  85. <body>
  86. <h1>V-DOCS Crash Reports</h1>
  87. ${SUMMARY}
  88. </body>
  89.  
  90. </html>
  91. EOF
  92. )
  93.  
  94. # Output to a file
  95. echo "$dashboard" > dashboard.html
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement