chg: [logs] add syslog level + facility + script startup message

This commit is contained in:
Terrtia 2022-09-08 13:40:02 +02:00
parent cdbb8cba35
commit 2d2e4a653e
No known key found for this signature in database
GPG key ID: 1E1B1F50D84613D0
3 changed files with 23 additions and 3 deletions

View file

@ -119,6 +119,14 @@ function launching_logs {
syslog_cmd="${syslog_cmd} -sp ${syslog_port}" syslog_cmd="${syslog_cmd} -sp ${syslog_port}"
fi fi
fi fi
syslog_facility=`cat $conf_dir/core.cfg | grep 'ail_logs_syslog_facility' | cut -d " " -f 3 `
if [ ! -z "$syslog_facility" -a "$str" != " " ]; then
syslog_cmd="${syslog_cmd} -sf ${syslog_facility}"
fi
syslog_level=`cat $conf_dir/core.cfg | grep 'ail_logs_syslog_level' | cut -d " " -f 3 `
if [ ! -z "$syslog_level" -a "$str" != " " ]; then
syslog_cmd="${syslog_cmd} -sl ${syslog_level}"
fi
screen -dmS "Logging_AIL" screen -dmS "Logging_AIL"
sleep 0.1 sleep 0.1

View file

@ -43,7 +43,6 @@ sys.path.append(os.environ['AIL_BIN'])
from modules.abstract_module import AbstractModule from modules.abstract_module import AbstractModule
from lib.ConfigLoader import ConfigLoader from lib.ConfigLoader import ConfigLoader
class Global(AbstractModule): class Global(AbstractModule):
""" """
Global module for AIL framework Global module for AIL framework
@ -52,7 +51,9 @@ class Global(AbstractModule):
def __init__(self): def __init__(self):
super(Global, self).__init__() super(Global, self).__init__()
self.r_stats = ConfigLoader().get_redis_conn("ARDB_Statistics") config_loader = ConfigLoader()
self.r_stats = config_loader.get_redis_conn("ARDB_Statistics")
self.r_serv_db = config_loader.get_redis_conn("ARDB_DB")
self.processed_item = 0 self.processed_item = 0
self.time_last_stats = time.time() self.time_last_stats = time.time()
@ -68,6 +69,11 @@ class Global(AbstractModule):
# Send module state to logs # Send module state to logs
self.redis_logger.info(f"Module {self.module_name} initialized") self.redis_logger.info(f"Module {self.module_name} initialized")
# Send module state to logs
self.redis_logger.critical(f"AIL {self.get_ail_uuid()} started")
def get_ail_uuid(self):
return self.r_serv_db.get('ail:uuid')
def computeNone(self): def computeNone(self):

View file

@ -24,9 +24,15 @@ sentiment_lexicon_file = sentiment/vader_lexicon.zip/vader_lexicon/vader_lexicon
##### Logs ###### ##### Logs ######
[Logs] [Logs]
# activate syslog
ail_logs_syslog = False ail_logs_syslog = False
ail_logs_syslog_server = ail_logs_syslog_server =
# default=514
ail_logs_syslog_port = ail_logs_syslog_port =
# ['auth', 'authpriv', 'cron', 'daemon', 'ftp', 'kern', 'lpr', 'mail', 'news', 'syslog', 'user', 'uucp', 'local0', 'local1', 'local2', 'local3', 'local4', 'local5', 'local6', 'local7']
ail_logs_syslog_facility =
# ['DEBUG', 'INFO', 'NOTICE', 'WARNING', 'ERROR', 'CRITICAL']
ail_logs_syslog_level =
##### Notifications ###### ##### Notifications ######
[Notifications] [Notifications]