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