HEX
Server: nginx/1.22.0
System: Linux iZuf6jdxbygmf6cco977lcZ 5.10.84-10.4.al8.x86_64 #1 SMP Tue Apr 12 12:31:07 CST 2022 x86_64
User: root (0)
PHP: 7.4.29
Disabled: passthru,exec,system,chroot,chgrp,chown,shell_exec,proc_open,proc_get_status,ini_alter,ini_restore,dl,readlink,symlink,popepassthru,stream_socket_server,fsocket,popen
Upload Files
File: //usr/local/aegis/PythonLoaderTemp/third_party/aegis_checker/offline/check_crash.py
# -*- coding: utf-8 -*-
import re
import sys

sys.path.append("..")

from aegis_checker.common.print_log import *
from aegis_checker.common.aegis_client_log_parser import LogObserver, LOG_INFO
from aegis_checker.info.check_result import *

class CrashObserver(LogObserver):
    def __init__(self):
        self.__crash_events = []

    def on_log(self, log_date, log_time, log_type, content, line, line_num, log_file_path):
        """
        2020-04-13 17:22:00 [Info] OnError:/usr/local/aegis/aegis_client/aegis_10_79/aegis_10_79-172.17.42.236-2020_4_13_17_22_0-Error.core
        2020-04-13 17:22:00 [Info] BackTrace:
        :param log_file_path:
        :param line_num:
        :param log_date:
        :param log_time:
        :param log_type: Debug, Info, Warn, Error, Critical
        :param content: log without timestamp and log type : "SendMessage T_MSG_LOGIN"
        :param line: origin log with timestamp and log type
        :return:
        """
        crash_reg = r"OnError:.+"
        if log_type == LOG_INFO and re.match(crash_reg, content):
            self.__crash_events.append(self.wrapper_event(log_date, log_time, content))

    def on_end(self, success):
        if len(self.__crash_events) > 0:
            set_root_cause(ROOT_CAUSE_AEGIS_CRASH, "offline issue may be caused by crash, crash time %d" % len(self.__crash_events))
            for crash_events in self.__crash_events:
                log_info("%s %s aegis client crash, log : %s" % (crash_events["date"], crash_events["time"],
                         crash_events["content"]))