From afa23ec7244a9a4d5ee6b0cc872886c1998a9068 Mon Sep 17 00:00:00 2001 From: Terrtia Date: Fri, 2 Sep 2022 14:26:18 +0200 Subject: [PATCH] chg: [logs] add syslog server option --- bin/LAUNCH.sh | 21 ++++++++++++++++++--- configs/core.cfg.sample | 6 ++++++ 2 files changed, 24 insertions(+), 3 deletions(-) diff --git a/bin/LAUNCH.sh b/bin/LAUNCH.sh index d6a5fbe6..7dc601df 100755 --- a/bin/LAUNCH.sh +++ b/bin/LAUNCH.sh @@ -105,14 +105,29 @@ function launching_ardb { } function launching_logs { + conf_dir="${AIL_HOME}/configs/" + syslog_cmd="" + syslog_enabled=`cat $conf_dir/core.cfg | grep 'ail_logs_syslog' | cut -d " " -f 3 ` + if [ "$syslog_enabled" = "True" ]; then + syslog_cmd="--syslog" + fi + syslog_server=`cat $conf_dir/core.cfg | grep 'ail_logs_syslog_server' | cut -d " " -f 3 ` + syslog_port=`cat $conf_dir/core.cfg | grep 'ail_logs_syslog_port' | cut -d " " -f 3 ` + if [ ! -z "$syslog_server" -a "$str" != " " ]; then + syslog_cmd="${syslog_cmd} -ss ${syslog_server}" + if [ ! -z "$syslog_port" -a "$str" != " " ]; then + syslog_cmd="${syslog_cmd} -sp ${syslog_port}" + fi + fi + screen -dmS "Logging_AIL" sleep 0.1 echo -e $GREEN"\t* Launching logging process"$DEFAULT - screen -S "Logging_AIL" -X screen -t "LogQueue" bash -c "cd ${AIL_BIN}; ${AIL_VENV}/bin/log_subscriber -p 6380 -c Queuing -l ../logs/; read x" + screen -S "Logging_AIL" -X screen -t "LogQueue" bash -c "cd ${AIL_BIN}; ${AIL_VENV}/bin/log_subscriber -p 6380 -c Queuing -l ../logs/ ${syslog_cmd}; read x" sleep 0.1 - screen -S "Logging_AIL" -X screen -t "LogScript" bash -c "cd ${AIL_BIN}; ${AIL_VENV}/bin/log_subscriber -p 6380 -c Script -l ../logs/; read x" + screen -S "Logging_AIL" -X screen -t "LogScript" bash -c "cd ${AIL_BIN}; ${AIL_VENV}/bin/log_subscriber -p 6380 -c Script -l ../logs/ ${syslog_cmd}; read x" sleep 0.1 - screen -S "Logging_AIL" -X screen -t "LogScript" bash -c "cd ${AIL_BIN}; ${AIL_VENV}/bin/log_subscriber -p 6380 -c Sync -l ../logs/; read x" + screen -S "Logging_AIL" -X screen -t "LogScript" bash -c "cd ${AIL_BIN}; ${AIL_VENV}/bin/log_subscriber -p 6380 -c Sync -l ../logs/ ${syslog_cmd}; read x" } function launching_queues { diff --git a/configs/core.cfg.sample b/configs/core.cfg.sample index 0a04268f..5a64ae36 100644 --- a/configs/core.cfg.sample +++ b/configs/core.cfg.sample @@ -22,6 +22,12 @@ pystemonpath = /home/pystemon/pystemon/ sentiment_lexicon_file = sentiment/vader_lexicon.zip/vader_lexicon/vader_lexicon.txt +##### Logs ###### +[Logs] +ail_logs_syslog = False +ail_logs_syslog_server = +ail_logs_syslog_port = + ##### Notifications ###### [Notifications] ail_domain = https://localhost:7000