Panic / reboot reason, logs, coredumps with history

How can i track panics and reboots reason? is there some logging availiable?
Can i trace multiple reboots/hangs? What kernel options besides debug symbols handy?

Yesterday I changes some boot variables and see today uptime is 2h
Can i do like i do for my program same for kernel?
Code:
debugcore ()
{
        binary_file=$1
        date=`date "+%Y-%m-%d_%H:%M:%S"`;
        DEBUG_LOG=$outpath$date.$binary_file.debug.log;
        BUG_LOG=$outpath$date.$binary_file.txt;
        echo "Server CRASHED !!! Start Bugreport System." >> $BUG_LOG
        echo "Server.log Log FILE Last 30 Lines:" >> $BUG_LOG
        cat $servlog | tail -n 30 >> $BUG_LOG
        echo "" >> $BUG_LOG
        echo "END bugtracker system." >> $BUG_LOG

        if test -n "$DEBUG" ; then
            echo "bt" > debug.cmds
            echo "bt full">> debug.cmds
            echo "info locals" >> debug.cmds
            echo "info sharedlibrary" >> debug.cmds
            echo "info frame" >> debug.cmds;  # works, but gives an error... must be last
            echo "----------------------------------------------" >> $DEBUG_LOG
            echo "CRASH: `date`" >> $DEBUG_LOG

            CORE="$binary_file.core"
            gdb $binary_file $CORE -x debug.cmds -batch >> $DEBUG_LOG
            rm -f debug.cmds
            mv $CORE $outpath$date.$CORE
        fi
}
 
Back
Top