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

Validated Tomcat installation before Linux

  • Loading branch information
psquickitjayant
psquickitjayant committed Jun 24, 2014
commit 7d1019027de004c2c21516135132c6ef6b67fcd7
@@ -54,30 +54,40 @@ LOG4J_FILE_PATH=
LOGGLY_CATALINA_HOME=

MANUAL_CONFIG_INSTRUCTION="Manual instructions to configure Tomcat is available at https://www.loggly.com/docs/tomcat-application-server"

#this variable will hold if the check env function for linux is invoked
TOMCAT_ENV_VALIDATED=
########## Variable Declarations - End ##########

#check if Tomcat environment is compatible for Loggly
checkTomcatLogglyCompatibility()
{
#check if the linux environment is compatible for Loggly
checkLinuxLogglyCompatibility

#deduce CATALINA_HOME, this sets the value for LOGGLY_CATALINA_HOME variable
deduceAndCheckTomcatHomeAndVersion

#check if tomcat is configured with log4j. If yes, then exit
checkIfTomcatConfiguredWithLog4J

TOMCAT_ENV_VALIDATED="true"
}


# executing the script for loggly to install and configure syslog.
installLogglyConfForTomcat()
{
installLogglyConf

#log message indicating starting of Loggly configuration
logMsgToConfigSysLog "INFO" "INFO: Initiating Configure Loggly for Tomcat."

#get CATALINA_HOME, this sets the value for LOGGLY_CATALINA_HOME variable
getTomcatHome $SERVICE

#check if the provided or deduced tomcat home is correct or not
checkIfValidTomcatHome

#set all the required tomcat variables by this script
setTomcatVariables

#check if tomcat version is supported by the script. The script only support tomcat 6 and 7
checkIfSupportedTomcatVersion

#check if tomcat is configured with log4j. If yes, then exit
checkIfTomcatConfiguredWithLog4J

#check if tomcat environment is compatible with Loggly
if [ "$TOMCAT_ENV_VALIDATED" = "" ]; then
checkTomcatLogglyCompatibility
fi

#configure loggly for Linux
installLogglyConf

#backing up the logging.properties file
backupLoggingPropertiesFile
@@ -94,27 +104,20 @@ installLogglyConfForTomcat()
#log success message
logMsgToConfigSysLog "SUCCESS" "SUCCESS: Tomcat successfully configured to send logs via Loggly."
}
# End of configure rsyslog for tomcat


#executing script to remove loggly configuration for tomcat
removeLogglyConfForTomcat()
{
logMsgToConfigSysLog "INFO" "INFO: Initiating rollback."

#check if the user has root permission to run this script
checkIfUserHasRootPrivileges

#check if the OS is supported by the script. If no, then exit
checkIfSupportedOS

#get CATALINA_HOME, this sets the value for LOGGLY_CATALINA_HOME variable
getTomcatHome $SERVICE

#check if the provided or deduced tomcat home is correct or not
checkIfValidTomcatHome

#set all the required tomcat variables by this script
setTomcatVariables
#deduce CATALINA_HOME, this sets the value for LOGGLY_CATALINA_HOME variable
deduceTomcatHomeAndVersion

#restore original loggly properties file from backup
restoreLogglyPropertiesFile
@@ -125,8 +128,91 @@ removeLogglyConfForTomcat()
logMsgToConfigSysLog "INFO" "INFO: Rollback completed."
}

#identify if tomcat6 or tomcat7 is installed on your system
deduceAndCheckTomcatHomeAndVersion()
{

if [ "$LOGGLY_CATALINA_HOME" = "" ]; then
LOGGLY_CATALINA_HOME=

#lets check if tomcat7 is installed on the system
SERVICE=tomcat7

#try to deduce tomcat home considering tomcat7
assumeTomcatHome $SERVICE

#initialize validTomcatHome variable with value true. This value will be toggled
#in the function checkIfValidTomcatHome fails
validTomcatHome="true"

#checks if the deduced tomcat7 home is correct or not
checkIfValidTomcatHome validTomcatHome

#if tomcat7 home is not valid one, move on to check for tomcat6
if [ "$validTomcatHome" = "false" ]; then

LOGGLY_CATALINA_HOME=

#lets check if tomcat6 is installed on the system
SERVICE=tomcat6

#try to deduce tomcat home considering tomcat6
assumeTomcatHome $SERVICE

#initialize validTomcatHome variable with value true. This value will be toggled
#in the function checkIfValidTomcatHome fails
validTomcatHome="true"

#checks if the deduced tomcat7 home is correct or not
checkIfValidTomcatHome validTomcatHome
fi

if [ "$validTomcatHome" = "true" ]; then
logMsgToConfigSysLog "INFO" "INFO: CATALINA HOME: $LOGGLY_CATALINA_HOME"

#set all the required tomcat variables by this script
setTomcatVariables

#find tomcat version
getTomcatVersion

#check if tomcat version is supported by the script. The script only support tomcat 6 and 7
checkIfSupportedTomcatVersion
else
logMsgToConfigSysLog "ERROR" "ERROR: Unable to determine correct CATALINA_HOME. Please provide correct Catalina Home using -ch option."
fi
else
#if the user has provided catalina_home, then we need to check if it is a valid catalina home and what is the correct version of the tomcat.
#Let us assume service name is tomcat for now, which will be updated later.
SERVICE=tomcat
checkIfValidTomcatHome validTomcatHome

if [ "$validTomcatHome" = "true" ]; then
logMsgToConfigSysLog "INFO" "INFO: CATALINA HOME: $LOGGLY_CATALINA_HOME"

#set tomcat variables
setTomcatVariables

#find tomcat version
getTomcatVersion

#check if tomcat version is supported by the script. The script only support tomcat 6 and 7
checkIfSupportedTomcatVersion

#update the service name
if ["$tomcatMajorVersion" = "7" ]; then
SERVICE=tomcat7
elif ["$tomcatMajorVersion" = "6" ]; then
SERVICE=tomcat6
fi
else
logMsgToConfigSysLog "ERROR" "ERROR: Provided Catalina Home is not correct. Please recheck."
fi
fi
}

#Get default location of tomcat home on various supported OS if user has not provided one
getTomcatHome()
assumeTomcatHome()
{
#if user has not provided the catalina home
if [ "$LOGGLY_CATALINA_HOME" = "" ]; then
@@ -142,7 +228,6 @@ getTomcatHome()
;;
esac
fi
logMsgToConfigSysLog "INFO" "INFO: CATALINA HOME: $LOGGLY_CATALINA_HOME"
}

#checks if the catalina home is a valid one by searching for logging.properties and
@@ -151,14 +236,14 @@ checkIfValidTomcatHome()
{
#check if logging.properties files is present
if [ ! -f "$LOGGLY_CATALINA_HOME/conf/logging.properties" ]; then
logMsgToConfigSysLog "ERROR" "ERROR: Unable to find conf/logging.properties file within $LOGGLY_CATALINA_HOME. Please provide correct Catalina Home using -ch option."
exit 1
logMsgToConfigSysLog "WARN" "WARN: Unable to find conf/logging.properties file within $LOGGLY_CATALINA_HOME."
eval $1="false"
#check if tomcat is configured as a service. If no, then check if we have access to startup.sh file
elif [ ! -f /etc/init.d/$SERVICE ]; then
logMsgToConfigSysLog "INFO" "INFO: Tomcat is not configured as a service"
if [ ! -f "$LOGGLY_CATALINA_HOME/bin/startup.sh" ]; then
logMsgToConfigSysLog "ERROR" "ERROR: Unable to find bin/startup.sh file within $LOGGLY_CATALINA_HOME. Please provide correct Catalina Home using -ch option."
exit 1
logMsgToConfigSysLog "WARN" "WARN: Unable to find bin/startup.sh file within $LOGGLY_CATALINA_HOME."
eval $1="false"
fi
fi
}
@@ -178,9 +263,8 @@ setTomcatVariables()
CATALINA_JAR_PATH=$LOGGLY_CATALINA_HOME/lib/catalina.jar
}

#checks if the tomcat version is supported by this script, currently the script
#only supports tomcat 6 and tomcat 7
checkIfSupportedTomcatVersion()
#get the version of tomcat
getTomcatVersion()
{
#check if the identified CATALINA_HOME has the catalina.jar
if [ ! -f "$CATALINA_JAR_PATH" ]; then
@@ -202,12 +286,17 @@ checkIfSupportedTomcatVersion()
TOMCAT_VERSION=${TOMCAT_VERSION#*: }
TOMCAT_VERSION=$TOMCAT_VERSION | tr -d ' '
APP_TAG="\"tomcat-version\":\"$TOMCAT_VERSION\""
fi
}

tomcatMajorVersion=${TOMCAT_VERSION%%.*}
if [[ ($tomcatMajorVersion -ne 6 ) && ($tomcatMajorVersion -ne 7) ]]; then
echo "ERROR" "ERROR: This script only supports Tomcat version 6 or 7."
exit 1
fi
#checks if the tomcat version is supported by this script, currently the script
#only supports tomcat 6 and tomcat 7
checkIfSupportedTomcatVersion()
{
tomcatMajorVersion=${TOMCAT_VERSION%%.*}
if [[ ($tomcatMajorVersion -ne 6 ) && ($tomcatMajorVersion -ne 7) ]]; then
logMsgToConfigSysLog "ERROR" "ERROR: This script only supports Tomcat version 6 or 7."
exit 1
fi
}

@@ -330,7 +419,7 @@ write21TomcatFileContents()
logMsgToConfigSysLog "INFO" "INFO: Creating file $TOMCAT_SYSLOG_CONFFILE"
sudo touch $TOMCAT_SYSLOG_CONFFILE
sudo chmod o+w $TOMCAT_SYSLOG_CONFFILE

imfileStr="\$ModLoad imfile
\$WorkDirectory $SYSLOG_DIR
"
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.