Simon Que | f70060c | 2012-04-09 19:07:07 -0700 | [diff] [blame] | 1 | # Copyright (c) 2012 The Chromium OS Authors. All rights reserved. |
Ken Mixter | c49dbd4 | 2010-12-14 17:44:11 -0800 | [diff] [blame] | 2 | # Use of this source code is governed by a BSD-style license that can |
| 3 | # be found in the LICENSE file. |
| 4 | |
Daniel Erat | 731da33 | 2015-01-28 09:48:10 -0700 | [diff] [blame] | 5 | # This file is parsed by chromeos::KeyValueStore. It has the format: |
Ken Mixter | c49dbd4 | 2010-12-14 17:44:11 -0800 | [diff] [blame] | 6 | # |
Daniel Erat | 731da33 | 2015-01-28 09:48:10 -0700 | [diff] [blame] | 7 | # <basename>=<shell command>\n |
Ken Mixter | c49dbd4 | 2010-12-14 17:44:11 -0800 | [diff] [blame] | 8 | # |
Daniel Erat | 731da33 | 2015-01-28 09:48:10 -0700 | [diff] [blame] | 9 | # Commands may be split across multiple lines using trailing backslashes. |
| 10 | # |
| 11 | # When an executable named <basename> crashes, the corresponding command is |
| 12 | # executed and its standard output and standard error are attached to the crash |
| 13 | # report. |
| 14 | # |
| 15 | # Use caution in modifying this file. Only run common Unix commands here, as |
| 16 | # these commands will be run when a crash has recently occurred and we should |
| 17 | # avoid running anything that might cause another crash. Similarly, these |
| 18 | # commands block notification of the crash to parent processes, so commands |
| 19 | # should execute quickly. |
Daniel Erat | 7e3b76d | 2015-01-26 18:03:30 -0700 | [diff] [blame] | 20 | |
Daniel Erat | 731da33 | 2015-01-28 09:48:10 -0700 | [diff] [blame] | 21 | update_engine=cat $(ls -1tr /var/log/update_engine | tail -5 | \ |
| 22 | sed s.^./var/log/update_engine/.) | tail -c 50000 |
Daniel Erat | 7e3b76d | 2015-01-26 18:03:30 -0700 | [diff] [blame] | 23 | |
Ben Chan | 557bf45 | 2012-03-14 16:51:01 -0700 | [diff] [blame] | 24 | # The cros_installer output is logged into the update engine log file, |
| 25 | # so it is handled in the same way as update_engine. |
Daniel Erat | 731da33 | 2015-01-28 09:48:10 -0700 | [diff] [blame] | 26 | cros_installer=cat $(ls -1tr /var/log/update_engine | tail -5 | \ |
| 27 | sed s.^./var/log/update_engine/.) | tail -c 50000 |
Ken Mixter | c49dbd4 | 2010-12-14 17:44:11 -0800 | [diff] [blame] | 28 | |
Daniel Erat | 8f5546a | 2015-01-21 16:24:08 -0700 | [diff] [blame] | 29 | # Dump the last 20 lines of the last two files in Chrome's system and user log |
Daniel Erat | 7e3b76d | 2015-01-26 18:03:30 -0700 | [diff] [blame] | 30 | # directories, along with the last 20 messages from the session manager. |
Daniel Erat | 731da33 | 2015-01-28 09:48:10 -0700 | [diff] [blame] | 31 | chrome=\ |
| 32 | for f in $(ls -1rt /var/log/chrome/chrome_[0-9]* | tail -2) \ |
| 33 | $(ls -1rt /home/chronos/u-*/log/chrome_[0-9]* 2>/dev/null | tail -2); do \ |
| 34 | echo "===$f (tail)==="; \ |
| 35 | tail -20 $f; \ |
| 36 | echo EOF; \ |
| 37 | echo; \ |
| 38 | done; \ |
| 39 | echo "===session_manager (tail)==="; \ |
| 40 | awk '$3 ~ "^session_manager\[" { print }' /var/log/messages | tail -20; \ |
| 41 | echo EOF |
Daniel Erat | 8f5546a | 2015-01-21 16:24:08 -0700 | [diff] [blame] | 42 | |
Ken Mixter | 1b8fe01 | 2011-01-25 13:33:05 -0800 | [diff] [blame] | 43 | # The following rule is used for generating additional diagnostics when |
| 44 | # collection of user crashes fails. This output should not be too large |
Michael Krebs | c046f57 | 2011-04-07 14:42:14 -0700 | [diff] [blame] | 45 | # as it is stored in memory. The output format specified for 'ps' is the |
| 46 | # same as with the "u" ("user-oriented") option, except it doesn't show |
| 47 | # the commands' arguments (i.e. "comm" instead of "command"). |
Daniel Erat | 731da33 | 2015-01-28 09:48:10 -0700 | [diff] [blame] | 48 | crash_reporter-user-collection=\ |
| 49 | echo "===ps output==="; \ |
| 50 | ps axw -o user,pid,%cpu,%mem,vsz,rss,tname,stat,start_time,bsdtime,comm | \ |
| 51 | tail -c 25000; \ |
| 52 | echo "===meminfo==="; \ |
| 53 | cat /proc/meminfo |
Ken Mixter | 1b8fe01 | 2011-01-25 13:33:05 -0800 | [diff] [blame] | 54 | |
Simon Que | f70060c | 2012-04-09 19:07:07 -0700 | [diff] [blame] | 55 | # This rule is similar to the crash_reporter-user-collection rule, except it is |
| 56 | # run for kernel errors reported through udev events. |
Daniel Erat | 731da33 | 2015-01-28 09:48:10 -0700 | [diff] [blame] | 57 | crash_reporter-udev-collection-change-card0-drm=\ |
| 58 | for dri in /sys/kernel/debug/dri/*; do \ |
| 59 | echo "===$dri/i915_error_state==="; \ |
| 60 | cat $dri/i915_error_state; \ |
| 61 | done |
Simon Que | f70060c | 2012-04-09 19:07:07 -0700 | [diff] [blame] | 62 | |
Yufeng Shen | bbda078 | 2012-11-05 17:06:34 -0500 | [diff] [blame] | 63 | # When trackpad driver cyapa detects some abnormal behavior, we collect |
| 64 | # additional logs from kernel messages. |
Daniel Erat | 731da33 | 2015-01-28 09:48:10 -0700 | [diff] [blame] | 65 | crash_reporter-udev-collection-change--i2c-cyapa=\ |
| 66 | /usr/sbin/kernel_log_collector.sh cyapa 30 |
| 67 | # When trackpad/touchscreen driver atmel_mxt_ts detects some abnormal behavior, |
| 68 | # we collect additional logs from kernel messages. |
| 69 | crash_reporter-udev-collection-change--i2c-atmel_mxt_ts=\ |
| 70 | /usr/sbin/kernel_log_collector.sh atmel 30 |
| 71 | # When touch device noise are detected, we collect relevant logs. |
| 72 | # (crosbug.com/p/16788) |
| 73 | crash_reporter-udev-collection---TouchNoise=cat /var/log/touch_noise.log |
Yufeng Shen | ebb86ae | 2013-01-15 19:55:09 -0500 | [diff] [blame] | 74 | # Periodically collect touch event log for debugging (crosbug.com/p/17244) |
Daniel Erat | 731da33 | 2015-01-28 09:48:10 -0700 | [diff] [blame] | 75 | crash_reporter-udev-collection---TouchEvent=cat /var/log/touch_event.log |
Daniel Erat | f290e98 | 2014-09-02 16:26:20 -0700 | [diff] [blame] | 76 | |
Peter Qiu | 6aa551e | 2015-03-06 11:42:04 -0800 | [diff] [blame] | 77 | # Collect the last 50 lines of /var/log/messages and /var/log/net.log for |
| 78 | # intel wifi driver (iwlwifi) for debugging purpose. |
| 79 | crash_reporter-udev-collection-devcoredump-iwlwifi=\ |
| 80 | echo "===/var/log/messages==="; \ |
| 81 | tail -n 50 /var/log/messages; \ |
| 82 | echo "===/var/log/net.log==="; \ |
| 83 | tail -n 50 /var/log/net.log; \ |
| 84 | echo EOF |
| 85 | |
Daniel Erat | f290e98 | 2014-09-02 16:26:20 -0700 | [diff] [blame] | 86 | # Dump the last 50 lines of the last two powerd log files -- if the job has |
| 87 | # already restarted, we want to see the end of the previous instance's logs. |
Daniel Erat | 731da33 | 2015-01-28 09:48:10 -0700 | [diff] [blame] | 88 | powerd=\ |
| 89 | for f in $(ls -1tr /var/log/power_manager/powerd.[0-9]* | tail -2); do \ |
| 90 | echo "===$(basename $f) (tail)==="; \ |
| 91 | tail -50 $f; \ |
| 92 | echo EOF; \ |
| 93 | done |
Daniel Erat | f290e98 | 2014-09-02 16:26:20 -0700 | [diff] [blame] | 94 | # If power_supply_info aborts (due to e.g. a bad battery), its failure message |
| 95 | # could end up in various places depending on which process was running it. |
| 96 | # Attach the end of powerd's log since it might've also logged the underlying |
| 97 | # problem. |
Daniel Erat | 731da33 | 2015-01-28 09:48:10 -0700 | [diff] [blame] | 98 | power_supply_info=\ |
| 99 | echo "===powerd.LATEST (tail)==="; \ |
| 100 | tail -50 /var/log/power_manager/powerd.LATEST; \ |
| 101 | echo EOF |
Daniel Erat | f290e98 | 2014-09-02 16:26:20 -0700 | [diff] [blame] | 102 | # powerd_setuid_helper gets run by powerd, so its stdout/stderr will be mixed in |
| 103 | # with powerd's stdout/stderr. |
Daniel Erat | 731da33 | 2015-01-28 09:48:10 -0700 | [diff] [blame] | 104 | powerd_setuid_helper=\ |
| 105 | echo "===powerd.OUT (tail)==="; \ |
| 106 | tail -50 /var/log/powerd.out; \ |
| 107 | echo EOF |
Daniel Erat | f290e98 | 2014-09-02 16:26:20 -0700 | [diff] [blame] | 108 | |
Ken Mixter | c49dbd4 | 2010-12-14 17:44:11 -0800 | [diff] [blame] | 109 | # The following rules are only for testing purposes. |
Daniel Erat | 731da33 | 2015-01-28 09:48:10 -0700 | [diff] [blame] | 110 | crash_log_test=echo hello world |
| 111 | crash_log_recursion_test=sleep 1 && \ |
| 112 | /usr/local/autotest/tests/crash_log_recursion_test |