diff options
author | Jim Hahn <jrh3@att.com> | 2018-05-21 15:02:40 -0400 |
---|---|---|
committer | Jim Hahn <jrh3@att.com> | 2018-05-23 14:57:16 -0400 |
commit | ee033842018375e0200a9b8f2e0dc813974440fd (patch) | |
tree | 9e6ebcb9dd132cb8f4ef3e6dac216ec467516f6f | |
parent | 1da6b3b6a28f40322a13e6fb5142206f1eefa027 (diff) |
Replace LOGPATH with LOGSUFFIX
docker-install.sh does not expand ${{xxx}} values in .conf
files before using them to update target files. Consequently,
replaced LOGPATH with LOGSUFFIX in .conf files and updated
target files to use ${{POLICY_LOGS}}${{LOGSUFFIX}} instead.
Replace "${POLICY_HOME}/logs" in auxiliary files (e.g., logrotate)
with "${POLICY_LOGS}/policy".
Update license dates.
In .sh files, changed ${{POLICY_LOGS}} to ${POLICY_LOGS}, and
ensured that env.sh is sourced.
Use hard-coded paths in conf files instead of replacing
LOGPATH with LOGSUFFIX.
Update license dates.
Repoint path for IntegrityMonitor.log, as we cannot easily move
since it's in common.
Replace hard-coded log path in docker-install.sh.
Undo hard-coded log paths where possible, and modify scripts to
pass $POLICY_LOGS to JVM.
Change-Id: I027d8d2173ae97fef73b0daff1d6a87452857f93
Issue-ID: POLICY-759
Signed-off-by: Jim Hahn <jrh3@att.com>
14 files changed, 40 insertions, 21 deletions
diff --git a/packages/base/src/files/bin/monitor.sh b/packages/base/src/files/bin/monitor.sh index 65baad4bc..e7d71b81e 100644 --- a/packages/base/src/files/bin/monitor.sh +++ b/packages/base/src/files/bin/monitor.sh @@ -2,7 +2,7 @@ # ============LICENSE_START======================================================= # ONAP Policy Engine # ================================================================================ -# Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. +# Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved. # ================================================================================ # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -26,7 +26,7 @@ function usage() { } function log() { - echo "$(date +"%Y-%m-%d_%H-%M-%S") $1" >> ${POLICY_HOME}/logs/monitor.log + echo "$(date +"%Y-%m-%d_%H-%M-%S") $1" >> ${POLICY_LOGS}/policy/monitor.log } function monitor() { diff --git a/packages/base/src/files/etc/logrotate.d/elk.conf b/packages/base/src/files/etc/logrotate.d/elk.conf index fc26f8991..74ec0ccf6 100644 --- a/packages/base/src/files/etc/logrotate.d/elk.conf +++ b/packages/base/src/files/etc/logrotate.d/elk.conf @@ -18,7 +18,7 @@ #============LICENSE_END================================================== # -${{POLICY_HOME}}/logs/elk.log { +${{POLICY_LOGS}}/policy/elk.log { daily rotate 10 compress diff --git a/packages/base/src/files/etc/logrotate.d/monitor.conf b/packages/base/src/files/etc/logrotate.d/monitor.conf index 6852a937f..7304103a7 100644 --- a/packages/base/src/files/etc/logrotate.d/monitor.conf +++ b/packages/base/src/files/etc/logrotate.d/monitor.conf @@ -18,7 +18,7 @@ #============LICENSE_END================================================== # -${{POLICY_HOME}}/logs/monitor.log { +${{POLICY_LOGS}}/policy/monitor.log { daily rotate 10 compress diff --git a/packages/base/src/files/install/elk/bin/elk.sh b/packages/base/src/files/install/elk/bin/elk.sh index 2f61547c9..86cfb46b3 100644 --- a/packages/base/src/files/install/elk/bin/elk.sh +++ b/packages/base/src/files/install/elk/bin/elk.sh @@ -29,7 +29,7 @@ function usage() { } function log() { - echo "$(date +"%Y-%m-%d_%H-%M-%S") $1" >> ${POLICY_HOME}/logs/elk.log + echo "$(date +"%Y-%m-%d_%H-%M-%S") $1" >> ${POLICY_LOGS}/policy/elk.log echo "$1" } @@ -128,7 +128,7 @@ function audit() { fi fi - $JAVA_HOME/bin/java -cp $POLICY_HOME/servers/pap/webapps/pap/WEB-INF/lib/ONAP-PAP-REST-*.jar:$POLICY_HOME/servers/pap/webapps/pap/WEB-INF/lib/*: -DPROPERTY_FILE=$POLICY_HOME/servers/pap/bin/policyelk.properties org.onap.policy.pap.xacml.rest.elk.client.ElasticSearchPolicyUpdate + $JAVA_HOME/bin/java -cp $POLICY_HOME/servers/pap/webapps/pap/WEB-INF/lib/ONAP-PAP-REST-*.jar:$POLICY_HOME/servers/pap/webapps/pap/WEB-INF/lib/*: -DPOLICY_LOGS=$POLICY_LOGS -DPROPERTY_FILE=$POLICY_HOME/servers/pap/bin/policyelk.properties org.onap.policy.pap.xacml.rest.elk.client.ElasticSearchPolicyUpdate } ######################################################################### @@ -175,6 +175,8 @@ if pidof -o %PPID -x $(basename $0) > /dev/null 2>&1; then exit 1 fi +. ${POLICY_HOME}/etc/profile.d/env.sh + case $OPERATION in audit) audit @@ -183,4 +185,4 @@ case $OPERATION in usage exit 1 ;; -esac
\ No newline at end of file +esac diff --git a/packages/base/src/files/install/elk/config/elasticsearch.yml b/packages/base/src/files/install/elk/config/elasticsearch.yml index 4191f0f6f..132f05ec9 100644 --- a/packages/base/src/files/install/elk/config/elasticsearch.yml +++ b/packages/base/src/files/install/elk/config/elasticsearch.yml @@ -56,7 +56,7 @@ node.name: "${{FQDN}}" # # Path to log files: # -path.logs: ${{POLICY_HOME}}/logs +path.logs: ${{POLICY_LOGS}} # # ----------------------------------- Memory ----------------------------------- # diff --git a/packages/base/src/files/install/elk/init.d/elkd b/packages/base/src/files/install/elk/init.d/elkd index 7b86904a9..11c6860a2 100644 --- a/packages/base/src/files/install/elk/init.d/elkd +++ b/packages/base/src/files/install/elk/init.d/elkd @@ -9,6 +9,8 @@ JMX_JAVA_OPTS="${JMX_JAVA_OPTS} -Dcom.sun.management.jmxremote.port=${{ELK_JMX_P JMX_JAVA_OPTS="${JMX_JAVA_OPTS} -Dcom.sun.management.jmxremote.ssl=false" JMX_JAVA_OPTS="${JMX_JAVA_OPTS} -Dcom.sun.management.jmxremote.authenticate=false" +CMD_JAVA_OPTS="${CMD_JAVA_OPTS} -DPOLICY_LOGS=${POLICY_LOGS}" + RETVAL=0 function update_monitor() { @@ -34,7 +36,7 @@ function stop() { } function start() { - export ES_JAVA_OPTS="${JAVA_OPTS} ${JMX_JAVA_OPTS}" + export ES_JAVA_OPTS="${JAVA_OPTS} ${JMX_JAVA_OPTS} ${CMD_JAVA_OPTS}" $POLICY_HOME/elk/bin/elasticsearch -d RETVAL=$? if [[ ${RETVAL} != 0 ]]; then @@ -46,6 +48,8 @@ function start() { # main +. ${POLICY_HOME}/etc/profile.d/env.sh + case "$1" in status) pid=$(pgrep -f -u ${POLICY_USER} "${ELK_RUNNING}" 2> /dev/null) diff --git a/packages/base/src/files/install/servers/brmsgw/init.d/brmsgw b/packages/base/src/files/install/servers/brmsgw/init.d/brmsgw index 0356b22ab..c951b12a4 100644 --- a/packages/base/src/files/install/servers/brmsgw/init.d/brmsgw +++ b/packages/base/src/files/install/servers/brmsgw/init.d/brmsgw @@ -34,7 +34,7 @@ function stop() { # unmonitored start, does not change monitor status (immutable) function um_start() { - unset JMX_JAVA_OPTS JVM_SECURITY + unset JMX_JAVA_OPTS JVM_SECURITY CMD_JAVA_OPTS JMX_JAVA_OPTS+=("-Dcom.sun.management.jmxremote") JMX_JAVA_OPTS+=("-Dcom.sun.management.jmxremote.port=$BRMSGW_JMX_PORT") JMX_JAVA_OPTS+=("-Dcom.sun.management.jmxremote.ssl=false") @@ -44,8 +44,9 @@ function um_start() { JVM_SECURITY+=("-Djavax.net.ssl.keyStorePassword=${KEYSTORE_PASSWD}") JVM_SECURITY+=("-Djavax.net.ssl.trustStore=${POLICY_HOME}/etc/ssl/policy-keystore") JVM_SECURITY+=("-Djavax.net.ssl.trustStorePassword=${KEYSTORE_PASSWD}") + CMD_JAVA_OPTS+=("-DPOLICY_LOGS=${POLICY_LOGS}") - JAVA_OPTS=("${JVM_JAVA_OPTS[@]}" "${JMX_JAVA_OPTS[@]}" "${JVM_SECURITY[@]}") + JAVA_OPTS=("${JVM_JAVA_OPTS[@]}" "${JMX_JAVA_OPTS[@]}" "${JVM_SECURITY[@]}" "${CMD_JAVA_OPTS[@]}") cd $POLICY_HOME/servers/brmsgw mkdir -p $POLICY_LOGS/policy/brmsgw 2>/dev/null diff --git a/packages/base/src/files/install/servers/common/logparser/init.d/logparserd b/packages/base/src/files/install/servers/common/logparser/init.d/logparserd index a8c9d5160..c526ca450 100755 --- a/packages/base/src/files/install/servers/common/logparser/init.d/logparserd +++ b/packages/base/src/files/install/servers/common/logparser/init.d/logparserd @@ -20,8 +20,10 @@ function um_start() { JMX_JAVA_OPTS="${JMX_JAVA_OPTS} -Dcom.sun.management.jmxremote.ssl=false" JMX_JAVA_OPTS="${JMX_JAVA_OPTS} -Dcom.sun.management.jmxremote.authenticate=false" JVM_JAVA_OPTS="-Xms${LOGPARSER_X_MS_MB}M -Xmx${LOGPARSER_X_MX_MB}M" + + CMD_JAVA_OPTS="-DPOLICY_LOGS=${POLICY_LOGS}" - JAVA_OPTS="${JAVA_OPTS} ${JMX_JAVA_OPTS} ${JVM_JAVA_OPTS}" + JAVA_OPTS="${JAVA_OPTS} ${JMX_JAVA_OPTS} ${JVM_JAVA_OPTS} ${CMD_JAVA_OPTS}" # Redirects default and error output to a log file cd ${POLICY_HOME}/servers/${COMPONENT}/bin diff --git a/packages/base/src/files/install/servers/common/tomcat/bin/setenv.sh b/packages/base/src/files/install/servers/common/tomcat/bin/setenv.sh index 0ba7ab8e4..dc9bfbc36 100644 --- a/packages/base/src/files/install/servers/common/tomcat/bin/setenv.sh +++ b/packages/base/src/files/install/servers/common/tomcat/bin/setenv.sh @@ -2,7 +2,7 @@ # ============LICENSE_START======================================================= # ONAP Policy Engine # ================================================================================ -# Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. +# Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved. # ================================================================================ # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -26,6 +26,7 @@ CATALINA_OPTS="${CATALINA_OPTS} -Djavax.net.ssl.keyStore=${POLICY_HOME}/etc/ssl/ CATALINA_OPTS="${CATALINA_OPTS} -Djavax.net.ssl.keyStorePassword=${KEYSTORE_PASSWD}" CATALINA_OPTS="${CATALINA_OPTS} -Djavax.net.ssl.trustStore=${POLICY_HOME}/etc/ssl/policy-keystore" CATALINA_OPTS="${CATALINA_OPTS} -Djavax.net.ssl.trustStorePassword=${KEYSTORE_PASSWD}" +CATALINA_OPTS="${CATALINA_OPTS} -DPOLICY_LOGS=${POLICY_LOGS}" CATALINA_OPTS="${CATALINA_OPTS} -Xms${{TOMCAT_X_MS_MB}}M" CATALINA_OPTS="${CATALINA_OPTS} -Xmx${{TOMCAT_X_MX_MB}}M" export CATALINA_OPTS diff --git a/packages/base/src/files/install/servers/paplp/bin/parserlog.properties b/packages/base/src/files/install/servers/paplp/bin/parserlog.properties index 9fe05cdbd..721fc77d6 100644 --- a/packages/base/src/files/install/servers/paplp/bin/parserlog.properties +++ b/packages/base/src/files/install/servers/paplp/bin/parserlog.properties @@ -2,7 +2,7 @@ # ============LICENSE_START======================================================= # ONAP Policy Engine # ================================================================================ -# Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. +# Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved. # ================================================================================ # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -20,6 +20,8 @@ # PAP LogParser properties +POLICY_LOGS=${{POLICY_LOGS}} + # JVM specific parameters LOGPARSER_JMX_PORT=${{LOGPARSER_JMX_PORT}} LOGPARSER_X_MS_MB=${{LOGPARSER_X_MS_MB}} @@ -32,7 +34,7 @@ JDBC_DRIVER=${{JDBC_DRIVER}} JDBC_URL='${{JDBC_LOG_URL}}' JDBC_USER=${{JDBC_USER}} JDBC_PASSWORD=${{JDBC_PASSWORD}} -PARSERLOGPATH=IntegrityMonitor.log +PARSERLOGPATH=${{PARSERLOGPATH}} # run this cleanup systemlogdb table once a day CHECK_INTERVAL=86400000 # timeFrame for removing old records from systemlogdb table diff --git a/packages/base/src/files/install/servers/pdplp/bin/parserlog.properties b/packages/base/src/files/install/servers/pdplp/bin/parserlog.properties index 071a18e4f..c2b3e5ffc 100755 --- a/packages/base/src/files/install/servers/pdplp/bin/parserlog.properties +++ b/packages/base/src/files/install/servers/pdplp/bin/parserlog.properties @@ -2,7 +2,7 @@ # ============LICENSE_START======================================================= # ONAP Policy Engine # ================================================================================ -# Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. +# Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved. # ================================================================================ # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -20,6 +20,8 @@ # PDP LogParser properties +POLICY_LOGS=${{POLICY_LOGS}} + # JVM specific parameters LOGPARSER_JMX_PORT=${{LOGPARSER_JMX_PORT}} LOGPARSER_X_MS_MB=${{LOGPARSER_X_MS_MB}} @@ -32,7 +34,7 @@ JDBC_DRIVER=${{JDBC_DRIVER}} JDBC_URL='${{JDBC_LOG_URL}}' JDBC_USER=${{JDBC_USER}} JDBC_PASSWORD=${{JDBC_PASSWORD}} -PARSERLOGPATH=IntegrityMonitor.log +PARSERLOGPATH=${{PARSERLOGPATH}} # run this cleanup systemlogdb table once a day CHECK_INTERVAL=86400000 # timeFrame for removing old records from systemlogdb table diff --git a/packages/docker/src/main/docker/docker-install.sh b/packages/docker/src/main/docker/docker-install.sh index 8274c6f7b..7521f6064 100644 --- a/packages/docker/src/main/docker/docker-install.sh +++ b/packages/docker/src/main/docker/docker-install.sh @@ -329,6 +329,11 @@ function install_base() { exit 1 fi + if ! /bin/mkdir -p "${POLICY_LOGS}" > /dev/null 2>&1; then + echo "error: aborting base installation: cannot create ${POLICY_LOGS}" + exit 1 + fi + if ! /bin/mkdir -p "${POLICY_HOME}/logs/" > /dev/null 2>&1; then echo "error: aborting base installation: cannot create ${POLICY_HOME}/logs/" exit 1 diff --git a/packages/install/src/files/paplp.conf b/packages/install/src/files/paplp.conf index c3fb62e19..de50a54a1 100755 --- a/packages/install/src/files/paplp.conf +++ b/packages/install/src/files/paplp.conf @@ -24,8 +24,8 @@ LOGPARSER_X_MS_MB=1024 LOGPARSER_X_MX_MB=1024 SERVER=https://${{FQDN}}:9091/pap/ -LOGPATH=${{POLICY_LOGS}}/policy/pap/pap-rest.log -PARSERLOGPATH=${{POLICY_LOGS}}/policy/pap/IntegrityMonitor.log +LOGPATH=${{POLICY_HOME}}/logs/policy/pap/pap-rest.log +PARSERLOGPATH=${{POLICY_HOME}}/servers/paplp/bin/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 38f1696de..79442ee5b 100755 --- a/packages/install/src/files/pdplp.conf +++ b/packages/install/src/files/pdplp.conf @@ -24,8 +24,8 @@ LOGPARSER_X_MS_MB=1024 LOGPARSER_X_MX_MB=1024 SERVER=https://${{FQDN}}:8081/pdp/ -LOGPATH=${{POLICY_LOGS}}/policy/pdpx/pdp-rest.log -PARSERLOGPATH=${{POLICY_LOGS}}/policy/pdpx/IntegrityMonitor.log +LOGPATH=${{POLICY_HOME}}/logs/policy/pdpx/pdp-rest.log +PARSERLOGPATH=${{POLICY_HOME}}/servers/pdplp/bin/IntegrityMonitor.log node_type=logparser # the java property is RESOURCE_NAME (uppercase), but the conf parameter is lowercase |