Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1220)

Unified Diff: src/platform/metrics/generate_logs

Issue 2103005: Add script to collect logs, dumps and other relevant information. (Closed) Base URL: http://src.chromium.org/git/chromium.git
Patch Set: More changes for optimization Created 10 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/platform/metrics/generate_logs
diff --git a/src/platform/metrics/generate_logs b/src/platform/metrics/generate_logs
new file mode 100755
index 0000000000000000000000000000000000000000..dfcdeea63d60294f04fb1450d15434a95e68a064
--- /dev/null
+++ b/src/platform/metrics/generate_logs
@@ -0,0 +1,82 @@
+#!/bin/sh
+#
+# Copyright (c) 2010 The Chromium OS Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+#
+# Copies all logs, screen-shots, crash dumps to Downloads folder.
+
+# Help information about script usage
+if ([ "$1" = -h ] || [ "$1" = -? ]); then
+ echo "Usage of generate_logs script:"
+ echo "To collect logs, dumps and screenshots: sh $0"
ruchic 2010/05/27 18:26:33 As discussed with Chris, there is some issue in ba
+ echo "To collect data and clear up folders: sh $0 --delete"
+ echo "Collected data is zipped to tar.bz2 file with timestamp in Downloads"
+ exit 1
+fi
+
+echo "Collecting logs for $USER user"
+home_dir=/home/$USER/user
+
+# Creating folder to copy logs, screenshots and dumps
+log_dir=$home_dir/Downloads/diagnostic_logs
+mkdir -p $log_dir
+sudo rm -rf $log_dir/*
+echo "Created log folder in Downloads"
+
+# Copying file with current timestamp and date
+date > $log_dir/timestamp.txt
+echo "Copied current timestamp"
+
+# Copying lsb-release file
+sudo cp /etc/lsb-release $log_dir
+echo "Copied lsb-release file with version information"
+
+# Copying logs- windows manager, screen-locker, messages, session_manager
+mkdir $log_dir/system_level_logs
+cp -r /var/log/messages \
+ /var/log/session_manager \
+ /var/log/softwareupdate.log \
+ /var/log/update_engine.log \
+ /var/log/window_manager \
+ $log_dir/system_level_logs
+cp -rf $home_dir/log $log_dir/user_level_logs
+echo "Copied relevant logs"
+
+# Copying screen-shots
+cp -rf $home_dir/Downloads/Screenshots $log_dir/screenshots 2> /dev/null && \
+ echo "Copied screen-shots"
+
+# Copying crash dumps and deleting from original location
+cp -rf $home_dir/.config/google-chrome/Crash\ Reports $log_dir/crashdumps 2> \
+ /dev/null && echo "Copied crash dumps"
+
+# Compressing the log folder with all collected files
+currentdate=$(date +%m%d%y-%H%M%S)
+tar cjfP $home_dir/Downloads/log-$currentdate.tar.bz2 $log_dir/
+sudo rm -rf $log_dir/*
+echo "Files zipped to folder under Downloads : log-$currentdate.tar.bz2"
+
+# Deleting logs, dumps, screenshots from original location with flag -delete
+if [ "$1" = --delete ]; then
+ echo "Deleting all logs "
+ sudo rm -rf /var/log/messages \
+ /var/log/session_manager \
+ /var/log/softwareupdate.log \
+ /var/log/update_engine.log \
+ /var/log/window_manager/*
+ sudo rm -rf $home_dir/log/*
+
+ echo "Deleting crash dumps"
+ sudo rm -rf $home_dir/.config/google-chrome/Crash\ Reports/*
+
+ echo "Deleting screen-shots"
+ sudo rm -rf $home_dir/Downloads/Screenshots/*
+
+ # Reboot after deleting all files
+ echo "Rebooting system after clean up in 1 minute"
+ sudo shutdown -r 1
+else
+ echo "Logs and dumps are copied but not deleted."
+ echo "To clear all logs, run the script with --delete flag"
+fi
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698