Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 37 additions & 1 deletion Modular Scripts/Apache2/configure-apache.sh
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,9 @@ write21ApacheConfFile() {
write21ApacheFileContents
break
;;
[Nn]*) break ;;
[Nn]*)
restartRsyslog
break ;;
*) echo "Please answer yes or no." ;;
esac
done
Expand Down Expand Up @@ -348,6 +350,40 @@ checkIfApacheLogsMadeToLoggly() {
fi
done

read -p "In order to check if Apache logs are successfully sent to Loggly, apache needs to produce logs. Do you want to create a log record by accessing server? (yes/no)" yn
case $yn in
[Yy]*)
#access a page on apache server in order to create a log record in access log file
WEB_ADDRESS=127.0.0.1
while true; do
read -p "Default check is performed on a localhost address 127.0.0.1 . Are you running an apache server with a different address? (yes/no)" yesno
case $yesno in
[Yy]*)
logMsgToConfigSysLog "INFO" "INFO: Using specific apache server address."
read -p "Please enter Apache server address " -r WEB_ADDRESS
;;
[Nn]*)
logMsgToConfigSysLog "INFO" "INFO: Using default apache server address."
;;
*) echo "Please answer yes or no." ;;
esac

RESPONSE_CODE=$(curl --max-time 10 -s -o /dev/null -i -w "%{http_code}" $WEB_ADDRESS)
#curl return 000 response on reaching max-time
if [ ${RESPONSE_CODE} != "000" ]; then
logMsgToConfigSysLog "INFO" "INFO: Curl on server $WEB_ADDRESS has succeeded"
break;
else
logMsgToConfigSysLog "INFO" "INFO: Curl on server $WEB_ADDRESS has failed."
fi
done
;;
[Nn]*)
logMsgToConfigSysLog "INFO" "INFO: Creating a sample log record has been skipped."
;;
*) echo "Please answer yes or no." ;;
esac

queryParam="$TAGS&from=-15m&until=now&size=1"
queryUrl="$LOGGLY_ACCOUNT_URL/apiv2/search?q=$queryParam"
logMsgToConfigSysLog "INFO" "INFO: Search URL: $queryUrl"
Expand Down