From ee033842018375e0200a9b8f2e0dc813974440fd Mon Sep 17 00:00:00 2001 From: Jim Hahn Date: Mon, 21 May 2018 15:02:40 -0400 Subject: 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 --- packages/base/src/files/install/elk/bin/elk.sh | 8 +++++--- packages/base/src/files/install/elk/config/elasticsearch.yml | 2 +- packages/base/src/files/install/elk/init.d/elkd | 6 +++++- 3 files changed, 11 insertions(+), 5 deletions(-) (limited to 'packages/base/src/files/install/elk') 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) -- cgit 1.2.3-korg