aboutsummaryrefslogtreecommitdiffstats
path: root/packages
diff options
context:
space:
mode:
authorChou, Joseph (JC2555) <jc2555@att.com>2018-03-22 11:22:35 -0400
committerChou, Joseph (JC2555) <jc2555@att.com>2018-03-23 18:05:27 -0400
commit669931e76de18aabb14f9ff873da4783f8c83d7a (patch)
treed289226c55b0e7adfe9f56ea6dc6f9e32120dbca /packages
parentcc7d8f696dd7717493dfc87e41884c7dd9923b83 (diff)
ONAP code change for log files consolidation
Code change for log files consolidation of PAP, PDP, BRMSGW, Console and db script Issue-ID: POLICY-562 Change-Id: I416ba7748b841bb2b1a31682e2b1631e279549e8 Signed-off-by: Chou, Joseph (JC2555) <jc2555@att.com>
Diffstat (limited to 'packages')
-rw-r--r--packages/base/src/files/etc/profile.d/env.sh2
-rw-r--r--packages/base/src/files/install/mysql/bin/cleanup_policy.sh8
-rw-r--r--packages/base/src/files/install/mysql/bin/db_backup.sh8
-rw-r--r--packages/base/src/files/install/mysql/bin/db_backup_data.sh8
-rw-r--r--packages/base/src/files/install/mysql/bin/db_backup_remote.sh9
-rw-r--r--packages/base/src/files/install/mysql/bin/db_restore.sh28
-rw-r--r--packages/base/src/files/install/mysql/bin/db_restore_data.sh7
-rw-r--r--packages/base/src/files/install/mysql/bin/db_upgrade.sh8
-rw-r--r--packages/base/src/files/install/mysql/bin/db_upgrade_remote.sh8
-rw-r--r--packages/base/src/files/install/servers/common/tomcat/conf/server.xml2
-rw-r--r--packages/base/src/files/install/servers/configs/conf/server.xml2
-rw-r--r--packages/base/src/files/install/servers/console/conf/server.xml2
-rw-r--r--packages/docker/src/main/docker/docker-install.sh7
-rw-r--r--packages/install/src/files/base.conf2
-rwxr-xr-xpackages/install/src/files/paplp.conf4
-rwxr-xr-xpackages/install/src/files/pdplp.conf4
16 files changed, 80 insertions, 29 deletions
diff --git a/packages/base/src/files/etc/profile.d/env.sh b/packages/base/src/files/etc/profile.d/env.sh
index 56b44260b..14445fbfd 100644
--- a/packages/base/src/files/etc/profile.d/env.sh
+++ b/packages/base/src/files/etc/profile.d/env.sh
@@ -25,3 +25,5 @@ export KEYSTORE_PASSWD=${{KEYSTORE_PASSWD}}
export JAVA_HOME=${{JAVA_HOME}}
export PATH=${PATH}:${{POLICY_HOME}}/bin
+
+export POLICY_LOGS=${{POLICY_LOGS}} \ No newline at end of file
diff --git a/packages/base/src/files/install/mysql/bin/cleanup_policy.sh b/packages/base/src/files/install/mysql/bin/cleanup_policy.sh
index 1841d3c57..969d089c0 100644
--- a/packages/base/src/files/install/mysql/bin/cleanup_policy.sh
+++ b/packages/base/src/files/install/mysql/bin/cleanup_policy.sh
@@ -71,8 +71,12 @@ function cleanup_deleted_policy
}
# MAIN
-LOG=$POLICY_HOME/logs/cleanup_policy_$DATE.log
-ERR=$POLICY_HOME/logs/cleanup_policy_$DATE.err
+if [ -z ${POLICY_LOGS} ]; then
+ POLICY_LOGS=/var/log/onap
+fi
+mkdir -p $POLICY_LOGS/policy/db
+LOG=$POLICY_LOGS/policy/db/cleanup_policy_$DATE.log
+ERR=$POLICY_LOGS/policy/db/cleanup_policy_$DATE.err
echo "cleanup_policy.sh started ... `date`" | tee -a $LOG
if [ $# -eq 3 ]; then
DB_USER="${1}"
diff --git a/packages/base/src/files/install/mysql/bin/db_backup.sh b/packages/base/src/files/install/mysql/bin/db_backup.sh
index dca2017ff..75d15364f 100644
--- a/packages/base/src/files/install/mysql/bin/db_backup.sh
+++ b/packages/base/src/files/install/mysql/bin/db_backup.sh
@@ -63,6 +63,12 @@ function backup_database
# MAIN
+if [ -z ${POLICY_LOGS} ]; then
+ POLICY_LOGS=/var/log/onap
+fi
+mkdir -p $POLICY_LOGS/policy/db
+LOG=$POLICY_LOGS/policy/db/db_backup_$DATE.log
+ERR=$POLICY_LOGS/policy/db/db_backup_$DATE.err
echo "db_backup.sh started ... `date`" | tee -a $LOG
if [ $# -eq 3 ]; then
DB_USER="${1}"
@@ -71,8 +77,6 @@ if [ $# -eq 3 ]; then
echo "DB_USER: $DB_USER" | tee -a $LOG
DAILY_BACKUP_DIR=$POLICY_HOME/data/mysql/$DATE
- LOG=$POLICY_HOME/logs/db_backup_$DATE.log
- ERR=$POLICY_HOME/logs/db_backup_$DATE.err
create_backup_dir
backup_database
diff --git a/packages/base/src/files/install/mysql/bin/db_backup_data.sh b/packages/base/src/files/install/mysql/bin/db_backup_data.sh
index ee0b44732..b77885e7d 100644
--- a/packages/base/src/files/install/mysql/bin/db_backup_data.sh
+++ b/packages/base/src/files/install/mysql/bin/db_backup_data.sh
@@ -63,8 +63,12 @@ function backup_database
# MAIN
-LOG=$POLICY_HOME/logs/db_backup_data_$DATE.log
-ERR=$POLICY_HOME/logs/db_backup_data_$DATE.err
+if [ -z ${POLICY_LOGS} ]; then
+ POLICY_LOGS=/var/log/onap
+fi
+mkdir -p $POLICY_LOGS/onap/policy/db
+LOG=$POLICY_LOGS/policy/db/db_backup_data_$DATE.log
+ERR=$POLICY_LOGS/policy/db/db_backup_data_$DATE.err
echo "db_backup_data.sh started ... `date`" | tee -a $LOG
if [ $# -eq 3 ]; then
DB_USER="${1}"
diff --git a/packages/base/src/files/install/mysql/bin/db_backup_remote.sh b/packages/base/src/files/install/mysql/bin/db_backup_remote.sh
index 212896942..72f31c33a 100644
--- a/packages/base/src/files/install/mysql/bin/db_backup_remote.sh
+++ b/packages/base/src/files/install/mysql/bin/db_backup_remote.sh
@@ -70,14 +70,19 @@ if [ $# -eq 4 ]; then
DB_PASSWORD="${2}"
DATABASE="${3}"
DB_HOSTNAME="${4}"
+ if [ -z ${POLICY_LOGS} ]; then
+ POLICY_LOGS=/var/log/onap
+ fi
+ mkdir -p $POLICY_LOGS/policy/db
+ LOG=$POLICY_LOGS/policy/db/db_backup_remote_$DATE.log
+ ERR=$POLICY_LOGS/policy/db/db_backup_remote_$DATE.err
+
echo "db_backup_remote.sh for [$DATABASE]@[${DB_HOSTNAME}] started ... `date`" | tee -a $LOG
echo "DB_USER : $DB_USER" | tee -a $LOG
echo "DATABASE : $DATABASE" | tee -a $LOG
echo "DB_HOSTNAME: $DB_HOSTNAME" | tee -a $LOG
DAILY_BACKUP_DIR=$POLICY_HOME/data/mysql/$DATE
- LOG=$POLICY_HOME/logs/db_backup_remote_$DATE.log
- ERR=$POLICY_HOME/logs/db_backup_remote_$DATE.err
create_backup_dir
backup_database
diff --git a/packages/base/src/files/install/mysql/bin/db_restore.sh b/packages/base/src/files/install/mysql/bin/db_restore.sh
index d6e21df79..765b0cad3 100644
--- a/packages/base/src/files/install/mysql/bin/db_restore.sh
+++ b/packages/base/src/files/install/mysql/bin/db_restore.sh
@@ -38,40 +38,48 @@ BACKUP_FILE=""
DATABASE=""
TABLE=""
TEMP_FILE=/tmp/db_restore_$$.sql
+DATE=`date +"%Y%m%d"`
+LOG=""
function restore_all
{
- echo "restore_all started ...@`date`"
- echo "Before restore table ..."
+ echo "restore_all started ...@`date`" | tee -a $LOG
+ echo "Before restore table ..." | tee -a $LOG
echo "--"
mysql -u${DB_USER} -p${DB_PASSWORD} < $BACKUP_FILE
echo "--"
- echo "restore_all completed ...@`date`"
+ echo "restore_all completed ...@`date`" | tee -a $LOG
}
function restore_table
{
database="${1}"
table="${2}"
- echo "restore_table [$database] [$table] started ...@`date`"
+ echo "restore_table [$database] [$table] started ...@`date`" | tee -a $LOG
# extract sql statement from backup file
- echo "use $database;" > $TEMP_FILE
+ echo "use $database;" > $TEMP_FILE
echo "set foreign_key_checks=0; " >> $TEMP_FILE
sed -n -e '/DROP TABLE IF EXISTS `'$table'`;/,/UNLOCK TABLES;/p' $BACKUP_FILE >> $TEMP_FILE
echo "set foreign_key_checks=1; " >> $TEMP_FILE
echo "--"
cat $TEMP_FILE
echo "--"
- echo "Before restore table ..."
+ echo "Before restore table ..." | tee -a $LOG
mysql -u${DB_USER} -p${DB_PASSWORD} < $TEMP_FILE
echo "--"
- echo "restore_table [$database] [$table] completed ...@`date`"
+ echo "restore_table [$database] [$table] completed ...@`date`" | tee -a $LOG
}
# MAIN
-echo "db_restore.sh started ... `date`"
+if [ -z ${POLICY_LOGS} ]; then
+ POLICY_LOGS=/var/log/onap
+fi
+mkdir -p $POLICY_LOGS/policy/db
+LOG=$POLICY_LOGS/policy/db/db_restore_$DATE.log
+
+echo "db_restore.sh started ... `date`" | tee -a $LOG
if [ $# -eq 5 ]; then
DB_USER="${1}"
DB_PASSWORD="${2}"
@@ -86,7 +94,7 @@ if [ $# -eq 5 ]; then
restore_all
fi
else
- echo "BACKUP FILE NOT FOUND: $BACKUP_FILE"
+ echo "BACKUP FILE NOT FOUND: $BACKUP_FILE" | tee -a $LOG
fi
else
echo "Usage : db_restore.sh db_user_id db_password backup_file database table_name"
@@ -94,4 +102,4 @@ else
fi
rm -f $TEMP_FILE
-echo "db_restore.sh completed ... `date`"
+echo "db_restore.sh completed ... `date`" | tee -a $LOG
diff --git a/packages/base/src/files/install/mysql/bin/db_restore_data.sh b/packages/base/src/files/install/mysql/bin/db_restore_data.sh
index c4fec027f..ec0874a67 100644
--- a/packages/base/src/files/install/mysql/bin/db_restore_data.sh
+++ b/packages/base/src/files/install/mysql/bin/db_restore_data.sh
@@ -40,6 +40,8 @@ BACKUP_FILE=""
DATABASE=""
TABLE=""
TEMP_FILE=/tmp/db_restore_data_$$.sql
+DATE=`date +"%Y%m%d"`
+LOG=""
function restore_all
{
@@ -85,6 +87,11 @@ if [ $# -eq 5 ]; then
typeset -l DATABASE="${4}"
typeset -l TABLE="${5}"
echo "DB_USER: $DB_USER"
+ if [ -z ${POLICY_LOGS} ]; then
+ POLICY_LOGS=/var/log/onap
+ fi
+ mkdir -p $POLICY_LOGS/policy/db
+ LOG=$POLICY_LOGS/policy/db/db_restore_data_$DATE.log
if [ -f $BACKUP_FILE ]; then
if [ "${TABLE}" != "all" ]; then
restore_table ${DATABASE} ${TABLE}
diff --git a/packages/base/src/files/install/mysql/bin/db_upgrade.sh b/packages/base/src/files/install/mysql/bin/db_upgrade.sh
index 87d5d9bd7..85a9218f5 100644
--- a/packages/base/src/files/install/mysql/bin/db_upgrade.sh
+++ b/packages/base/src/files/install/mysql/bin/db_upgrade.sh
@@ -124,8 +124,12 @@ function check_directory
# MAIN
#check_directory
-LOG=$POLICY_HOME/logs/db_upgrade_$DATE.log
-ERR=$POLICY_HOME/logs/db_upgrade_$DATE.err
+if [ -z ${POLICY_LOGS} ]; then
+ POLICY_LOGS=/var/log/onap
+fi
+mkdir -p $POLICY_LOGS/policy/db
+LOG=$POLICY_LOGS/policy/db/db_upgrade_$DATE.log
+ERR=$POLICY_LOGS/policy/db/db_upgrade_$DATE.err
echo "db_upgrade.sh started ..." | tee -a $LOG
if [ $# -eq 3 ]; then
TARGET_RELEASE="${1}"
diff --git a/packages/base/src/files/install/mysql/bin/db_upgrade_remote.sh b/packages/base/src/files/install/mysql/bin/db_upgrade_remote.sh
index a10ac2173..c4316816e 100644
--- a/packages/base/src/files/install/mysql/bin/db_upgrade_remote.sh
+++ b/packages/base/src/files/install/mysql/bin/db_upgrade_remote.sh
@@ -146,8 +146,12 @@ function check_directory
# MAIN
#check_directory
-LOG=$POLICY_HOME/logs/db_upgrade_remote_$DATE.log
-ERR=$POLICY_HOME/logs/db_upgrade_remote_$DATE.err
+if [ -z ${POLICY_LOGS} ]; then
+ POLICY_LOGS=/var/log/onap
+fi
+mkdir -p $POLICY_LOGS/policy/db
+LOG=$POLICY_LOGS/policy/db/db_upgrade_remote_$DATE.log
+ERR=$POLICY_LOGS/policy/db/db_upgrade_remote_$DATE.err
echo "db_upgrade_remote.sh started ..." | tee -a $LOG
if [ $# -eq 3 ]; then
DB_UPGRADE_USER="${1}"
diff --git a/packages/base/src/files/install/servers/common/tomcat/conf/server.xml b/packages/base/src/files/install/servers/common/tomcat/conf/server.xml
index 787347283..0aca4ead7 100644
--- a/packages/base/src/files/install/servers/common/tomcat/conf/server.xml
+++ b/packages/base/src/files/install/servers/common/tomcat/conf/server.xml
@@ -157,7 +157,7 @@
<!-- Access log processes all example.
Documentation at: /docs/config/valve.html
Note: The pattern used is equivalent to using pattern="common" -->
- <Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs"
+ <Valve className="org.apache.catalina.valves.AccessLogValve" directory="/var/log/onap/policy"
prefix="localhost_access_log" suffix=".txt"
pattern="%h %l %u %t &quot;%r&quot; %s %b" />
diff --git a/packages/base/src/files/install/servers/configs/conf/server.xml b/packages/base/src/files/install/servers/configs/conf/server.xml
index 2a6191e99..a9bf21bbe 100644
--- a/packages/base/src/files/install/servers/configs/conf/server.xml
+++ b/packages/base/src/files/install/servers/configs/conf/server.xml
@@ -159,7 +159,7 @@
<!-- Access log processes all example.
Documentation at: /docs/config/valve.html
Note: The pattern used is equivalent to using pattern="common" -->
- <Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs"
+ <Valve className="org.apache.catalina.valves.AccessLogValve" directory="/var/log/onap/policy"
prefix="localhost_access_log" suffix=".txt"
pattern="%h %l %u %t &quot;%r&quot; %s %b" />
diff --git a/packages/base/src/files/install/servers/console/conf/server.xml b/packages/base/src/files/install/servers/console/conf/server.xml
index 53d563bba..b3fa674b0 100644
--- a/packages/base/src/files/install/servers/console/conf/server.xml
+++ b/packages/base/src/files/install/servers/console/conf/server.xml
@@ -162,7 +162,7 @@
<!-- Access log processes all example.
Documentation at: /docs/config/valve.html
Note: The pattern used is equivalent to using pattern="common" -->
- <Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs"
+ <Valve className="org.apache.catalina.valves.AccessLogValve" directory="/var/log/onap/policy/console"
prefix="localhost_access_log" suffix=".txt"
pattern="%h %l %u %t &quot;%r&quot; %s %b" />
diff --git a/packages/docker/src/main/docker/docker-install.sh b/packages/docker/src/main/docker/docker-install.sh
index e8b9aaf14..c15f36f38 100644
--- a/packages/docker/src/main/docker/docker-install.sh
+++ b/packages/docker/src/main/docker/docker-install.sh
@@ -151,6 +151,7 @@ function configure_component() {
SED_LINE+=" -e 's!\${{KEYSTORE_PASSWD}}!${KEYSTORE_PASSWD}!g' "
SED_LINE+=" -e 's!\${{JAVA_HOME}}!${JAVA_HOME}!g' "
SED_LINE+=" -e 's!\${{COMPONENT_TYPE}}!${COMPONENT_TYPE}!g' "
+ SED_LINE+=" -e 's!\${{POLICY_LOGS}}!${POLICY_LOGS}!g' "
while read line || [ -n "${line}" ]; do
if [[ -n $line ]] && [[ $line != \#* ]]; then
@@ -658,6 +659,12 @@ if [[ -z ${POLICY_GROUP} ]]; then
exit 1
fi
+if [[ -z ${POLICY_LOGS} ]]; then
+ echo "POLICY_LOGS environment variable NOT set, default to /var/log"
+ export POLICY_LOGS="/var/log/onap"
+fi
+
+
FQDN=$(hostname -f 2> /dev/null)
if [[ $? != 0 || -z ${FQDN} ]]; then
echo "error: cannot determine the FQDN for this host $(hostname)."
diff --git a/packages/install/src/files/base.conf b/packages/install/src/files/base.conf
index cd08d4a41..a64cd3ee7 100644
--- a/packages/install/src/files/base.conf
+++ b/packages/install/src/files/base.conf
@@ -17,3 +17,5 @@ max_fpc_update_interval=60
test_via_jmx=false
ENVIRONMENT=TEST
+
+POLICY_LOGS=/var/log/onap \ No newline at end of file
diff --git a/packages/install/src/files/paplp.conf b/packages/install/src/files/paplp.conf
index f5a6d096b..ec7578be7 100755
--- a/packages/install/src/files/paplp.conf
+++ b/packages/install/src/files/paplp.conf
@@ -4,8 +4,8 @@ LOGPARSER_X_MS_MB=1024
LOGPARSER_X_MX_MB=1024
SERVER=https://${{FQDN}}:9091/pap/
-LOGPATH=${{POLICY_HOME}}/servers/pap/logs/pap-rest.log
-PARSERLOGPATH=IntegrityMonitor.log
+LOGPATH=${{POLICY_LOGS}}/policy/pap/pap-rest.log
+PARSERLOGPATH=${{POLICY_LOGS}}/policy/pap/IntegrityMonitor.log
node_type=logparser
# the java property is RESOURCE_NAME (uppercase), but the conf parameter is lowercase
diff --git a/packages/install/src/files/pdplp.conf b/packages/install/src/files/pdplp.conf
index 750537819..f791a3f79 100755
--- a/packages/install/src/files/pdplp.conf
+++ b/packages/install/src/files/pdplp.conf
@@ -4,8 +4,8 @@ LOGPARSER_X_MS_MB=1024
LOGPARSER_X_MX_MB=1024
SERVER=https://${{FQDN}}:8081/pdp/
-LOGPATH=${{POLICY_HOME}}/servers/pdp/logs/pdp-rest.log
-PARSERLOGPATH=IntegrityMonitor.log
+LOGPATH=${{POLICY_LOGS}}/policy/pdpx/pdp-rest.log
+PARSERLOGPATH==${{POLICY_LOGS}}/policy/pdpx/IntegrityMonitor.log
node_type=logparser
# the java property is RESOURCE_NAME (uppercase), but the conf parameter is lowercase