blob: 7db308cb0d3b362638597b1cd0757df90fa0a233 [file] [log] [blame]
Steve Fung6c34c252015-08-20 00:27:30 -07001# 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 Mixterc49dbd42010-12-14 17:44:11 -080014
Daniel Erat731da332015-01-28 09:48:10 -070015# This file is parsed by chromeos::KeyValueStore. It has the format:
Ken Mixterc49dbd42010-12-14 17:44:11 -080016#
Daniel Erat731da332015-01-28 09:48:10 -070017# <basename>=<shell command>\n
Ken Mixterc49dbd42010-12-14 17:44:11 -080018#
Daniel Erat731da332015-01-28 09:48:10 -070019# 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 Erat7e3b76d2015-01-26 18:03:30 -070030
Daniel Erat731da332015-01-28 09:48:10 -070031update_engine=cat $(ls -1tr /var/log/update_engine | tail -5 | \
32 sed s.^./var/log/update_engine/.) | tail -c 50000
Daniel Erat7e3b76d2015-01-26 18:03:30 -070033
Ben Chan557bf452012-03-14 16:51:01 -070034# 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 Erat731da332015-01-28 09:48:10 -070036cros_installer=cat $(ls -1tr /var/log/update_engine | tail -5 | \
37 sed s.^./var/log/update_engine/.) | tail -c 50000
Ken Mixterc49dbd42010-12-14 17:44:11 -080038
Daniel Erat8f5546a2015-01-21 16:24:08 -070039# Dump the last 20 lines of the last two files in Chrome's system and user log
Daniel Erat7e3b76d2015-01-26 18:03:30 -070040# directories, along with the last 20 messages from the session manager.
Daniel Erat731da332015-01-28 09:48:10 -070041chrome=\
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 Erat8f5546a2015-01-21 16:24:08 -070052
Ken Mixter1b8fe012011-01-25 13:33:05 -080053# The following rule is used for generating additional diagnostics when
54# collection of user crashes fails. This output should not be too large
Michael Krebsc046f572011-04-07 14:42:14 -070055# 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 Erat731da332015-01-28 09:48:10 -070058crash_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 Mixter1b8fe012011-01-25 13:33:05 -080064
Simon Quef70060c2012-04-09 19:07:07 -070065# This rule is similar to the crash_reporter-user-collection rule, except it is
66# run for kernel errors reported through udev events.
Daniel Erat731da332015-01-28 09:48:10 -070067crash_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 Quef70060c2012-04-09 19:07:07 -070072
Yufeng Shenbbda0782012-11-05 17:06:34 -050073# When trackpad driver cyapa detects some abnormal behavior, we collect
74# additional logs from kernel messages.
Daniel Erat731da332015-01-28 09:48:10 -070075crash_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.
79crash_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)
83crash_reporter-udev-collection---TouchNoise=cat /var/log/touch_noise.log
Yufeng Shenebb86ae2013-01-15 19:55:09 -050084# Periodically collect touch event log for debugging (crosbug.com/p/17244)
Daniel Erat731da332015-01-28 09:48:10 -070085crash_reporter-udev-collection---TouchEvent=cat /var/log/touch_event.log
Daniel Eratf290e982014-09-02 16:26:20 -070086
Peter Qiu6aa551e2015-03-06 11:42:04 -080087# Collect the last 50 lines of /var/log/messages and /var/log/net.log for
88# intel wifi driver (iwlwifi) for debugging purpose.
89crash_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 Eratf290e982014-09-02 16:26:20 -070096# 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 Erat731da332015-01-28 09:48:10 -070098powerd=\
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 Eratf290e982014-09-02 16:26:20 -0700104# 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 Erat731da332015-01-28 09:48:10 -0700108power_supply_info=\
109 echo "===powerd.LATEST (tail)==="; \
110 tail -50 /var/log/power_manager/powerd.LATEST; \
111 echo EOF
Daniel Eratf290e982014-09-02 16:26:20 -0700112# powerd_setuid_helper gets run by powerd, so its stdout/stderr will be mixed in
113# with powerd's stdout/stderr.
Daniel Erat731da332015-01-28 09:48:10 -0700114powerd_setuid_helper=\
115 echo "===powerd.OUT (tail)==="; \
116 tail -50 /var/log/powerd.out; \
117 echo EOF
Daniel Eratf290e982014-09-02 16:26:20 -0700118
Ken Mixterc49dbd42010-12-14 17:44:11 -0800119# The following rules are only for testing purposes.
Daniel Erat731da332015-01-28 09:48:10 -0700120crash_log_test=echo hello world
121crash_log_recursion_test=sleep 1 && \
122 /usr/local/autotest/tests/crash_log_recursion_test