Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added modular scripts - Tomcat, Apache2, File Monitorin, S3 File Monitoring and Nginx Server #69

Merged
merged 96 commits into from Oct 21, 2014
Merged
Changes from 1 commit
Commits
Show all changes
96 commits
Select commit Hold shift + click to select a range
a24007e
Added customer token to configsyslog
Jun 24, 2014
7d10190
Validated Tomcat installation before Linux
Jun 24, 2014
b12a1f1
Added support to check Loggly port reachabilty
Jun 26, 2014
4160bca
Support for Tomcat downloaded as a package
Jun 26, 2014
8e46033
Added Apache2 Configuration Script
Jun 30, 2014
040fcaf
Download Linux script inside it
Jul 1, 2014
3f133cd
Downloads Linux script inside it
Jul 1, 2014
1e00b42
Logging OS name to Loggly if unsupported
Jul 3, 2014
c6b391f
Updated Red Hat to RedHat
Jul 3, 2014
1de793f
Updated RedhHat/ CentOS log file name
Jul 3, 2014
318770b
Stop of the user do not want to restart tomcat
Jul 3, 2014
dc77925
No verification if already configured
Jul 4, 2014
e6d46eb
No verification if already configured
Jul 4, 2014
afb9a36
Updated typos and link
Jul 4, 2014
2868b89
Removed duplicate variables and updated message
Jul 9, 2014
cb88b8f
Removed duplicate variables
Jul 9, 2014
b0115f9
Added file monitoring script
Jul 9, 2014
dee3dc3
Updated Manual link and Logging file name also
Jul 10, 2014
8e21171
Updated warning text
Jul 11, 2014
69324a4
Updated message text
Jul 11, 2014
200fd93
Made token optional
Jul 11, 2014
4bfbbc0
Made token optional
Jul 11, 2014
6f4412f
Made token optional
Jul 11, 2014
a1b6222
Check if the file name/ path contains spaces
Jul 14, 2014
1ae7d6b
Removed Extra characters
Jul 14, 2014
fe0a452
Updated version 1.0 to 1.01
Jul 14, 2014
0cf4b30
Updated message
Jul 15, 2014
1d22a45
Removed extra break
Jul 15, 2014
d63e96d
Updated text message
Jul 15, 2014
c6197df
Configure script if log file size is 0
Jul 16, 2014
9a98ed3
Configure Script if log file size is 0
Jul 16, 2014
8bffdca
Added README.md for the Linux Script
Jul 18, 2014
35323ad
Updated README
Jul 18, 2014
5d6e636
Create README.md
Jul 18, 2014
3752d2c
Create README.md
Jul 18, 2014
c4bf094
Update README.md
Jul 18, 2014
04891f1
Update README.md
Jul 18, 2014
14f566d
Create README.md
Jul 18, 2014
138ef2f
Incorporated Manoj's Feedback
Jul 21, 2014
aac29fa
Incorporated Manoj's Feedback
Jul 21, 2014
b45d7e9
Update README.md
Jul 21, 2014
be5085d
Update README.md
Jul 21, 2014
2364a89
Update README.md
Jul 21, 2014
e96a030
Update README.md
Jul 21, 2014
4c2ffe6
Updated script to support any Linux OS
Jul 23, 2014
302c243
Merge branch 'master' of https://github.com/psquickitjayant/install-s…
Jul 23, 2014
85df450
Added s3 monitoring scripts
Jul 25, 2014
f9c864d
Add support to Amazon AMI OS
Jul 27, 2014
8fee938
Removed extra variable
Jul 28, 2014
2cac672
Updated command
Jul 28, 2014
6c54ab7
Updated version number
Jul 28, 2014
c64f4b3
Updated version number
Jul 28, 2014
e7a7328
Updated version number
Jul 28, 2014
3d44e13
Updated Scripts (Under development)
Jul 28, 2014
beccd2a
Added check for sub domain
Jul 29, 2014
9d522f8
Changed message if Mac OSX found
Jul 30, 2014
151b89e
Revert "Changed message if Mac OSX found"
Jul 30, 2014
cc07795
Changed message if "Darwin OS"
Jul 30, 2014
9787d95
Updated s3 Script. Under Developement
Jul 30, 2014
29d982b
Added comments
Jul 30, 2014
bc505b9
Add support to download bucket/ file using -s3b
Jul 31, 2014
cfb1435
Minor Bug Fix
Jul 31, 2014
dcab550
Updated s3b to s3url and Minor bug fixes
Aug 1, 2014
2f3cf7e
Added more checks for the bucket name validation
Aug 4, 2014
b8abcd0
Removed extra quotes
Aug 5, 2014
7eac676
Updated script to support s3 file monitoring
Aug 5, 2014
a9436f9
Added check for the directory
Aug 5, 2014
991e9fb
Delete Temp Folder after Rollback
Aug 6, 2014
c22bc30
Added dynamic tag to modify from other scripts
Aug 7, 2014
9919125
Fixed a bug
Aug 7, 2014
cda8b4b
Revert "Fixed a bug"
Aug 7, 2014
c7d1e72
S3 Script: Added "s3file" tag
Aug 7, 2014
7dbf18a
Updated script to support multiple Linux machines
Aug 18, 2014
b84686d
File-Monitoring-
Aug 19, 2014
b7f7443
Revert "File-Monitoring-"
Aug 19, 2014
a2d377e
File-monitoring: Added support to set Format name
Aug 19, 2014
408af55
S3 Script: Setting New Format name
Aug 19, 2014
20e0ef3
Updated Path for configure-file-monitoring.sh
Aug 21, 2014
8989253
Updated Path for configure-linux.sh
Aug 21, 2014
8b62c0f
Updated Path for configure-file-monitoring.sh
Aug 21, 2014
c716576
Updated Path for configure-linux.sh
Aug 21, 2014
fd0d765
Merged script-dev changes
Sep 26, 2014
4e38937
Create README.md
Sep 26, 2014
1118c5b
Update README.md
Sep 26, 2014
a05c43a
Update README.md
Sep 26, 2014
b896a25
Update README.md
Sep 26, 2014
d17eca2
Update README.md
Sep 26, 2014
7e7bc4c
Updated ReadMes
Sep 26, 2014
b0d9732
Skipping permissions check on RedHat and CentOS
Sep 26, 2014
b55c680
Minor modifications
Sep 30, 2014
3e0cb26
Nginx Script: Initial Commit
Sep 30, 2014
03c5b2d
Update README.md
Sep 30, 2014
ac442f4
Create README.md
Sep 30, 2014
9cfdb4c
Update README.md
Sep 30, 2014
cf1c248
Nginx Script: Updated manual configuration link
Oct 3, 2014
476a5ef
File Monitoring: Added tag as parameter
Oct 7, 2014
File filter...
Filter file types
Jump to…
Jump to file
Failed to load files.

Always

Just for now

Merged script-dev changes

Also updated dependencies link to Loggly
  • Loading branch information
psquickitjayant
psquickitjayant committed Sep 26, 2014
commit fd0d765c51f16be866ed6668332b412e8945c3a2
@@ -15,7 +15,7 @@ function ctrl_c() {
#name of the current script. This will get overwritten by the child script which calls this
SCRIPT_NAME=configure-linux.sh
#version of the current script. This will get overwritten by the child script which calls this
SCRIPT_VERSION=1.5
SCRIPT_VERSION=1.7

#application tag. This will get overwritten by the child script which calls this
APP_TAG=
@@ -145,10 +145,12 @@ installLogglyConf()
if [ "$LINUX_DO_VERIFICATION" = "true" ]; then
#check if the logs are going to loggly fro linux system now
checkIfLogsMadeToLoggly
fi

#log success message
if [ "$IS_INVOKED" = "" ]; then
logMsgToConfigSysLog "SUCCESS" "SUCCESS: Linux system successfully configured to send logs via Loggly."
fi

}

#remove loggly configuration from Linux system
@@ -269,15 +271,15 @@ checkIfLogglyServersAccessible()
if [ $(ping -c 1 $LOGS_01_HOST | grep "1 packets transmitted, 1 received, 0% packet loss" | wc -l) == 1 ]; then
echo "INFO: $LOGS_01_HOST is reachable."
else
logMsgToConfigSysLog "ERROR" "ERROR: $LOGS_01_HOST is not reachable. Please check your network and firewall settings. Continuing to configure Loggly on your system."
logMsgToConfigSysLog "ERROR" "ERROR: $LOGS_01_HOST is not reachable. Please check your network and firewall settings."
exit 1
fi

echo "INFO: Checking if $LOGS_01_HOST is reachable via $LOGGLY_SYSLOG_PORT port. This may take some time."
if [ $(curl --connect-timeout 10 $LOGS_01_HOST:$LOGGLY_SYSLOG_PORT 2>&1 | grep "Empty reply from server" | wc -l) == 1 ]; then
echo "INFO: $LOGS_01_HOST is reachable via $LOGGLY_SYSLOG_PORT port."
else
logMsgToConfigSysLog "ERROR" "ERROR: $LOGS_01_HOST is not reachable via $LOGGLY_SYSLOG_PORT port. Please check your network and firewall settings. Continuing to configure Loggly on your system."
logMsgToConfigSysLog "ERROR" "ERROR: $LOGS_01_HOST is not reachable via $LOGGLY_SYSLOG_PORT port. Please check your network and firewall settings."
exit 1
fi

@@ -401,22 +403,8 @@ write22LogglyConfFile()
{
echo "INFO: Checking if loggly sysconf file $LOGGLY_RSYSLOG_CONFFILE exist."
if [ -f "$LOGGLY_RSYSLOG_CONFFILE" ]; then
logMsgToConfigSysLog "WARN" "WARN: Loggly rsyslog file $LOGGLY_RSYSLOG_CONFFILE already exist."
while true; do
read -p "Do you wish to override $LOGGLY_RSYSLOG_CONFFILE and re-verify configuration? (yes/no)" yn
case $yn in
[Yy]* )
logMsgToConfigSysLog "INFO" "INFO: Going to back up the conf file: $LOGGLY_RSYSLOG_CONFFILE to $LOGGLY_RSYSLOG_CONFFILE_BACKUP";
sudo mv -f $LOGGLY_RSYSLOG_CONFFILE $LOGGLY_RSYSLOG_CONFFILE_BACKUP;
checkAuthTokenAndWriteContents;
break;;
[Nn]* )
LINUX_DO_VERIFICATION="false"
logMsgToConfigSysLog "INFO" "INFO: Skipping Linux verification."
break;;
* ) echo "Please answer yes or no.";;
esac
done
logMsgToConfigSysLog "INFO" "INFO: Loggly rsyslog file $LOGGLY_RSYSLOG_CONFFILE already exist."
checkIfConfigurationChanged
else
logMsgToConfigSysLog "INFO" "INFO: Loggly rsyslog file $LOGGLY_RSYSLOG_CONFFILE does not exist, creating file $LOGGLY_RSYSLOG_CONFFILE"
checkAuthTokenAndWriteContents
@@ -435,6 +423,48 @@ checkAuthTokenAndWriteContents()
fi
}

#matches if the content of 22-loggly.conf content is changed
checkIfConfigurationChanged()
{
ASK_FOR_VERIFICATION="false"

#strings to be checked which should be present in the existing 22-loggly.conf.
#If these strings are not same then a warning message will be shown to user to update the 22-loggly.conf file
STR_TO_BE_CHECKED[0]="\$template LogglyFormat,\"<%pri%>%protocol-version% %timestamp:::date-rfc3339% %HOSTNAME% %app-name% %procid% %msgid% [$LOGGLY_AUTH_TOKEN@$LOGGLY_DISTRIBUTION_ID] %msg%\""
STR_TO_BE_CHECKED[1]="*.* @@$LOGS_01_HOST:$LOGGLY_SYSLOG_PORT;LogglyFormat"

for i in "${STR_TO_BE_CHECKED[@]}"
do
if ! sudo grep -Fxq "$i" $LOGGLY_RSYSLOG_CONFFILE; then
ASK_FOR_VERIFICATION="true"
break;
fi
done

if [ "$ASK_FOR_VERIFICATION" == "true" ]; then
logMsgToConfigSysLog "WARN" "WARN: Loggly rsyslog file $LOGGLY_RSYSLOG_CONFFILE content is incorrect."
while true;
do
read -p "Do you wish to override $LOGGLY_RSYSLOG_CONFFILE and re-verify configuration? (yes/no)" yn
case $yn in
[Yy]* )
logMsgToConfigSysLog "INFO" "INFO: Going to back up the conf file: $LOGGLY_RSYSLOG_CONFFILE to $LOGGLY_RSYSLOG_CONFFILE_BACKUP";
sudo mv -f $LOGGLY_RSYSLOG_CONFFILE $LOGGLY_RSYSLOG_CONFFILE_BACKUP;
checkAuthTokenAndWriteContents;
break;;
[Nn]* )
LINUX_DO_VERIFICATION="false"
logMsgToConfigSysLog "INFO" "INFO: Skipping Linux verification."
break;;
* ) echo "Please answer yes or no.";;
esac
done
else
LINUX_DO_VERIFICATION="false"
fi

}

#write the contents to 22-loggly.conf file
writeContents()
{
@@ -506,7 +536,7 @@ checkIfLogsMadeToLoggly()
let counter=$counter+1
if [ "$counter" -gt "$maxCounter" ]; then
MANUAL_CONFIG_INSTRUCTION=$MANUAL_CONFIG_INSTRUCTION" Rsyslog troubleshooting instructions are available at https://www.loggly.com/docs/troubleshooting-rsyslog/"
logMsgToConfigSysLog "ERROR" "ERROR: Verification logs did not make it to Loggly in time. Please check your token & network/firewall settings and retry."
logMsgToConfigSysLog "ERROR" "ERROR: Logs did not make to Loggly in time. Please check network and firewall settings and retry."
exit 1
fi
done
@@ -601,9 +631,9 @@ logMsgToConfigSysLog()
sendPayloadToConfigSysLog()
{
if [ "$APP_TAG" = "" ]; then
var="{\"sub-domain\":\"$LOGGLY_ACCOUNT\", \"user-name\":\"$LOGGLY_USERNAME\", \"customer-token\":\"$LOGGLY_AUTH_TOKEN\", \"host-name\":\"$HOST_NAME\", \"script-name\":\"$SCRIPT_NAME\", \"script-version\":\"$SCRIPT_VERSION\", \"status\":\"$1\", \"time-stamp\":\"$currentTime\", \"linux-distribution\":\"$LINUX_DIST\", \"messages\":\"$2\"}"
var="{\"sub-domain\":\"$LOGGLY_ACCOUNT\", \"user-name\":\"$LOGGLY_USERNAME\", \"customer-token\":\"$LOGGLY_AUTH_TOKEN\", \"host-name\":\"$HOST_NAME\", \"script-name\":\"$SCRIPT_NAME\", \"script-version\":\"$SCRIPT_VERSION\", \"status\":\"$1\", \"time-stamp\":\"$currentTime\", \"linux-distribution\":\"$LINUX_DIST\", \"messages\":\"$2\",\"rsyslog-version\":\"$RSYSLOG_VERSION\"}"
else
var="{\"sub-domain\":\"$LOGGLY_ACCOUNT\", \"user-name\":\"$LOGGLY_USERNAME\", \"customer-token\":\"$LOGGLY_AUTH_TOKEN\", \"host-name\":\"$HOST_NAME\", \"script-name\":\"$SCRIPT_NAME\", \"script-version\":\"$SCRIPT_VERSION\", \"status\":\"$1\", \"time-stamp\":\"$currentTime\", \"linux-distribution\":\"$LINUX_DIST\", $APP_TAG, \"messages\":\"$2\"}"
var="{\"sub-domain\":\"$LOGGLY_ACCOUNT\", \"user-name\":\"$LOGGLY_USERNAME\", \"customer-token\":\"$LOGGLY_AUTH_TOKEN\", \"host-name\":\"$HOST_NAME\", \"script-name\":\"$SCRIPT_NAME\", \"script-version\":\"$SCRIPT_VERSION\", \"status\":\"$1\", \"time-stamp\":\"$currentTime\", \"linux-distribution\":\"$LINUX_DIST\", $APP_TAG, \"messages\":\"$2\",\"rsyslog-version\":\"$RSYSLOG_VERSION\"}"
fi
curl -s -H "content-type:application/json" -d "$var" $LOGS_01_URL/inputs/$3 > /dev/null 2>&1
}
@@ -297,7 +297,7 @@ checkIfApacheLogsMadeToLoggly()
searchAndFetch apacheLatestLogCount "$queryUrl"
let counter=$counter+1
if [ "$counter" -gt "$maxCounter" ]; then
logMsgToConfigSysLog "ERROR" "ERROR: Apache logs did not make to Loggly in time. Please check your token & network/firewall settings and retry."
logMsgToConfigSysLog "ERROR" "ERROR: Apache logs did not make to Loggly in time. Please check network and firewall settings and retry."
exit 1
fi
done
@@ -9,7 +9,7 @@ source configure-linux.sh "being-invoked"
#name of the current script
SCRIPT_NAME=configure-file-monitoring.sh
#version of the current script
SCRIPT_VERSION=1.3
SCRIPT_VERSION=1.4

#file to monitor (contains complete path and file name) provided by user
LOGGLY_FILE_TO_MONITOR=
@@ -57,6 +57,9 @@ installLogglyConfForFile()
#check if file to monitor exists
checkIfFileExist

#checks if the file has proper read permission
checkFileReadPermission

#check if the alias is already taken
checkIfFileAliasExist

@@ -189,6 +192,18 @@ checkLogFileSize()
fi
}


#checks the input file has proper read permissions
checkFileReadPermission()
{
FILE_PERMISSIONS=$(ls -l $LOGGLY_FILE_TO_MONITOR)
#checking if the file has read permission for others
PERMISSION_READ_OTHERS=${FILE_PERMISSIONS:7:1}
if [ $PERMISSION_READ_OTHERS != r ]; then
logMsgToConfigSysLog "WARN" "WARN: $LOGGLY_FILE_TO_MONITOR does not have proper read permissions. Verification step may fail."
fi
}

#function to write the contents of syslog config file
write21ConfFileContents()
{
@@ -259,7 +274,7 @@ checkIfFileLogsMadeToLoggly()
searchAndFetch fileLatestLogCount "$queryUrl"
let counter=$counter+1
if [ "$counter" -gt "$maxCounter" ]; then
logMsgToConfigSysLog "ERROR" "ERROR: Logs did not make to Loggly in time. Please check your token & network/firewall settings and retry."
logMsgToConfigSysLog "ERROR" "ERROR: File logs did not make to Loggly in time. Please check network and firewall settings and retry."
exit 1
fi
done
@@ -8,7 +8,7 @@ source configure-file-monitoring.sh "being-invoked"
#name of the current script
SCRIPT_NAME=configure-s3-file-monitoring.sh
#version of the current script
SCRIPT_VERSION=1.1
SCRIPT_VERSION=1.3

#s3 bucket name to configure
LOGGLY_S3_BUCKET_NAME=
@@ -67,15 +67,16 @@ installLogglyConfForS3()
#invoke file monitoring on each file after checking if it is a text file or not
invokeS3FileMonitoring

#install a cron job to sync the downloaded files after each 5 minutes
installCronToSyncS3BucketPeriodically

if [ "$IS_ANY_FILE_CONFIGURED" != "false" ]; then
#check if s3 logs made it to loggly
checkIfS3LogsMadeToLoggly
else
logMsgToConfigSysLog "WARN" "WARN: Did not find any files to configure. Nothing to do."
fi

#delete temporary directory
#deleteTempDir

}


@@ -95,9 +96,12 @@ removeLogglyConfForS3()

#remove file monitoring
removeS3FileMonitoring

#delete the s3 sync cron from the crontab
deleteS3CronFromCrontab

#delete temporary directory if exists
TEMP_DIR=/tmp/$LOGGLY_S3_ALIAS
TEMP_DIR=/tmp/s3monitoring/$LOGGLY_S3_ALIAS
deleteTempDir

#log success message
@@ -165,8 +169,8 @@ downloadS3cmd()
#configure s3cmd
configureS3cmd()
{
s3cmd --configure
IS_S3CMD_CONFIGURED_BY_SCRIPT="true"
sudo s3cmd --configure
IS_S3CMD_CONFIGURED_BY_SCRIPT="true"
#check if s3cmd configured successfully now
checkIfS3cmdConfigured
}
@@ -203,7 +207,7 @@ checkIfValidS3Bucket()

createTempDir()
{
TEMP_DIR=/tmp/$LOGGLY_S3_ALIAS
TEMP_DIR=/tmp/s3monitoring/$LOGGLY_S3_ALIAS
if [ -d "$TEMP_DIR" ]; then
if [ "$(ls -A $TEMP_DIR)" ]; then
logMsgToConfigSysLog "WARN" "WARN: There are some files/folders already present in $TEMP_DIR. If you continue, the files currently inside the $TEMP_DIR will also be configured to send logs to loggly."
@@ -221,7 +225,12 @@ createTempDir()
done
fi
else
mkdir /tmp/$LOGGLY_S3_ALIAS
if [ -d "/tmp/s3monitoring" ]; then
mkdir /tmp/s3monitoring/$LOGGLY_S3_ALIAS
else
mkdir /tmp/s3monitoring
mkdir /tmp/s3monitoring/$LOGGLY_S3_ALIAS
fi
fi
}

@@ -231,7 +240,7 @@ downloadS3Bucket()
#Files are downloaded in nested directory
cd $TEMP_DIR
echo "Downloading files, may take some time..."
s3cmd get -r -f $LOGGLY_S3_BUCKET_NAME > /dev/null 2>&1
sudo s3cmd get -r -f $LOGGLY_S3_BUCKET_NAME > /dev/null 2>&1
if [ $? -ne 0 ]; then
logMsgToConfigSysLog "ERROR" "ERROR: Error downloading files recursively from $LOGGLY_S3_BUCKET_NAME"
exit 1
@@ -242,7 +251,7 @@ downloadS3Bucket()

invokeS3FileMonitoring()
{
dir=/tmp/$LOGGLY_S3_ALIAS
dir=/tmp/s3monitoring/$LOGGLY_S3_ALIAS
#TODO: Not supporting multiple files with same name in different directories
#only supporting file with naming convention *.*
for f in $(find $dir -name '*')
@@ -260,6 +269,7 @@ invokeS3FileMonitoring()
LOGGLY_FILE_TAG="s3file"
CONF_FILE_FORMAT_NAME="LogglyFormatS3"
constructFileVariables
checkFileReadPermission
checkLogFileSize $LOGGLY_FILE_TO_MONITOR
write21ConfFileContents
IS_ANY_FILE_CONFIGURED="true"
@@ -274,6 +284,68 @@ invokeS3FileMonitoring()
fi
}

installCronToSyncS3BucketPeriodically()
{
while true; do
read -p "Would you like install a Cron job to sync the files currently in your bucket every 5 minutes? (yes/no)" yn
case $yn in
[Yy]* )

#copying .s3cfg file to /root so that it can be used by crontab for sync
if ! sudo test -f "/root/.s3cfg" ; then
sudo cp $HOME/.s3cfg /root
fi

CRON_FILE="/tmp/s3monitoring/cron_$LOGGLY_S3_ALIAS"
CRON_SYNC_PATH="/tmp/s3monitoring/$LOGGLY_S3_ALIAS"

#checking if the provided s3 path if of directory or file
IS_DIR="true"
BUCKET_URL_LAST_VALUE=$(echo ${LOGGLY_S3_BUCKET_NAME##*/})

if [ "$BUCKET_URL_LAST_VALUE" != "" ]; then
for fle in $(find $CRON_SYNC_PATH -name $BUCKET_URL_LAST_VALUE)
do
if [ -f $fle ]; then
IS_DIR="false"
break
fi
done
fi

#adding file name to the sync folder as the bucket path is
#provided upto a file
if [ "$IS_DIR" == "false" ]; then
CRON_SYNC_PATH="$CRON_SYNC_PATH/$BUCKET_URL_LAST_VALUE"
fi

logMsgToConfigSysLog "INFO" "INFO: Creating a Cron job to sync $LOGGLY_S3_BUCKET_NAME files to $CRON_SYNC_PATH in every five minutes."

#setting up cron job
CRON_JOB_TO_SYNC_S3_BUCKET="*/5 * * * * s3cmd sync $LOGGLY_S3_BUCKET_NAME --preserve $CRON_SYNC_PATH"

EXISTING_CRONS=$(sudo crontab -l 2>&1)
case $EXISTING_CRONS in
no*)
;;
*)
echo "$EXISTING_CRONS" >> $CRON_FILE
;;
esac

echo "$CRON_JOB_TO_SYNC_S3_BUCKET" >> $CRON_FILE
sudo crontab $CRON_FILE
sudo rm -fr $CRON_FILE
break;;
[Nn]* )
logMsgToConfigSysLog "INFO" "INFO: Skipping Cron installation."
break;;
* ) echo "Please answer yes or no.";;
esac
done

}

deleteTempDir()
{
if [ -d "$TEMP_DIR" ]; then
@@ -307,7 +379,7 @@ checkIfS3LogsMadeToLoggly()
searchAndFetch fileLatestLogCount "$queryUrl"
let counter=$counter+1
if [ "$counter" -gt "$maxCounter" ]; then
logMsgToConfigSysLog "ERROR" "ERROR: Logs did not make to Loggly in time. Please check your token & network/firewall settings and retry."
logMsgToConfigSysLog "ERROR" "ERROR: S3 logs did not make to Loggly in time. Please check network and firewall settings and retry."
exit 1
fi
done
@@ -347,6 +419,12 @@ removeS3FileMonitoring()
restartRsyslog
}

deleteS3CronFromCrontab()
{
logMsgToConfigSysLog "INFO" "INFO: Deleting sync Cron."
sudo crontab -l | grep -v "/tmp/s3monitoring/$LOGGLY_S3_ALIAS" | crontab -
}

#display usage syntax
usage()
{
@@ -568,7 +568,7 @@ checkIfTomcatLogsMadeToLoggly()
searchAndFetch tomcatLatestLogCount "$queryUrl"
let counter=$counter+1
if [ "$counter" -gt "$maxCounter" ]; then
logMsgToConfigSysLog "ERROR" "ERROR: Tomcat logs did not make to Loggly in time. Please check your token & network/firewall settings and retry."
logMsgToConfigSysLog "ERROR" "ERROR: Tomcat logs did not make to Loggly in time. Please check network and firewall settings and retry."
exit 1
fi
done
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.