blob: f5ca80c915dfe980b26eec7db0dddb314340a17a [file] [log] [blame]
Simon Quef70060c2012-04-09 19:07:07 -07001# Copyright (c) 2012 The Chromium OS Authors. All rights reserved.
Ken Mixterc49dbd42010-12-14 17:44:11 -08002# Use of this source code is governed by a BSD-style license that can
3# be found in the LICENSE file.
4
Daniel Erat731da332015-01-28 09:48:10 -07005# This file is parsed by chromeos::KeyValueStore. It has the format:
Ken Mixterc49dbd42010-12-14 17:44:11 -08006#
Daniel Erat731da332015-01-28 09:48:10 -07007# <basename>=<shell command>\n
Ken Mixterc49dbd42010-12-14 17:44:11 -08008#
Daniel Erat731da332015-01-28 09:48:10 -07009# 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 Erat7e3b76d2015-01-26 18:03:30 -070020
Daniel Erat731da332015-01-28 09:48:10 -070021update_engine=cat $(ls -1tr /var/log/update_engine | tail -5 | \
22 sed s.^./var/log/update_engine/.) | tail -c 50000
Daniel Erat7e3b76d2015-01-26 18:03:30 -070023
Ben Chan557bf452012-03-14 16:51:01 -070024# 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 Erat731da332015-01-28 09:48:10 -070026cros_installer=cat $(ls -1tr /var/log/update_engine | tail -5 | \
27 sed s.^./var/log/update_engine/.) | tail -c 50000
Ken Mixterc49dbd42010-12-14 17:44:11 -080028
Daniel Erat8f5546a2015-01-21 16:24:08 -070029# Dump the last 20 lines of the last two files in Chrome's system and user log
Daniel Erat7e3b76d2015-01-26 18:03:30 -070030# directories, along with the last 20 messages from the session manager.
Daniel Erat731da332015-01-28 09:48:10 -070031chrome=\
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 Erat8f5546a2015-01-21 16:24:08 -070042
Ken Mixter1b8fe012011-01-25 13:33:05 -080043# The following rule is used for generating additional diagnostics when
44# collection of user crashes fails. This output should not be too large
Michael Krebsc046f572011-04-07 14:42:14 -070045# 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 Erat731da332015-01-28 09:48:10 -070048crash_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 Mixter1b8fe012011-01-25 13:33:05 -080054
Simon Quef70060c2012-04-09 19:07:07 -070055# This rule is similar to the crash_reporter-user-collection rule, except it is
56# run for kernel errors reported through udev events.
Daniel Erat731da332015-01-28 09:48:10 -070057crash_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 Quef70060c2012-04-09 19:07:07 -070062
Yufeng Shenbbda0782012-11-05 17:06:34 -050063# When trackpad driver cyapa detects some abnormal behavior, we collect
64# additional logs from kernel messages.
Daniel Erat731da332015-01-28 09:48:10 -070065crash_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.
69crash_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)
73crash_reporter-udev-collection---TouchNoise=cat /var/log/touch_noise.log
Yufeng Shenebb86ae2013-01-15 19:55:09 -050074# Periodically collect touch event log for debugging (crosbug.com/p/17244)
Daniel Erat731da332015-01-28 09:48:10 -070075crash_reporter-udev-collection---TouchEvent=cat /var/log/touch_event.log
Daniel Eratf290e982014-09-02 16:26:20 -070076
Peter Qiu6aa551e2015-03-06 11:42:04 -080077# Collect the last 50 lines of /var/log/messages and /var/log/net.log for
78# intel wifi driver (iwlwifi) for debugging purpose.
79crash_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 Eratf290e982014-09-02 16:26:20 -070086# 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 Erat731da332015-01-28 09:48:10 -070088powerd=\
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 Eratf290e982014-09-02 16:26:20 -070094# 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 Erat731da332015-01-28 09:48:10 -070098power_supply_info=\
99 echo "===powerd.LATEST (tail)==="; \
100 tail -50 /var/log/power_manager/powerd.LATEST; \
101 echo EOF
Daniel Eratf290e982014-09-02 16:26:20 -0700102# powerd_setuid_helper gets run by powerd, so its stdout/stderr will be mixed in
103# with powerd's stdout/stderr.
Daniel Erat731da332015-01-28 09:48:10 -0700104powerd_setuid_helper=\
105 echo "===powerd.OUT (tail)==="; \
106 tail -50 /var/log/powerd.out; \
107 echo EOF
Daniel Eratf290e982014-09-02 16:26:20 -0700108
Ken Mixterc49dbd42010-12-14 17:44:11 -0800109# The following rules are only for testing purposes.
Daniel Erat731da332015-01-28 09:48:10 -0700110crash_log_test=echo hello world
111crash_log_recursion_test=sleep 1 && \
112 /usr/local/autotest/tests/crash_log_recursion_test