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

All the changes between the two forks. #81

Merged
merged 28 commits into from Jul 13, 2016
Merged
Changes from 1 commit
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
882b339
checking connectivity using telnet
varshneyjayant May 13, 2015
8eb4f1a
Added check for xcode command line tools
varshneyjayant May 15, 2015
b7c061f
fluent.conf now created in .loggly
varshneyjayant May 19, 2015
f8d885f
Added support to Tomcat 8 (package version)
Jul 9, 2015
8cca0cf
Added new syntax support
varshneyjayant Jan 11, 2016
3e40991
Added support for Access logs
varshneyjayant Jan 22, 2016
b87e366
Added support for Access logs
varshneyjayant Jan 22, 2016
13f4681
Merge pull request #3 from psquickitjayant/script-dev-2
varshneyjayant Jan 27, 2016
6961b2e
Added Mac script README link
varshneyjayant Jan 27, 2016
7c8a520
Create update-loggly-certificate.sh
varshneyjayant Feb 26, 2016
94c641b
Default Test Mode and Bug Fixes
varshneyjayant Feb 29, 2016
9620d00
Updated Certificate Path
varshneyjayant Mar 1, 2016
e03a420
Updated Certificate Path
varshneyjayant Mar 2, 2016
e4be7a7
Added Trapping Control + C
varshneyjayant Mar 3, 2016
b3ae0af
Added Sleep after updating Hosts file
varshneyjayant Mar 4, 2016
15dc9f7
Added MaxMessageSize
varshneyjayant Mar 9, 2016
69b90da
Configure Tomcat Access Logs
varshneyjayant Mar 9, 2016
97afefe
Added support for Systemd
varshneyjayant Mar 14, 2016
1c5ff65
Added support for Systemd
varshneyjayant Mar 14, 2016
09c09c3
Added support for Rsyslog Systemd service
varshneyjayant Mar 23, 2016
2f8d252
Added support for Systemd
varshneyjayant Mar 31, 2016
ee9768e
Delete configure-linux-systemd.sh
varshneyjayant Mar 31, 2016
a3200f0
Updated Script Version
varshneyjayant Mar 31, 2016
b78ff00
Changed Fluentd's install directory
varshneyjayant Apr 6, 2016
bae0b60
Fixed Base64 decode issue
varshneyjayant Apr 6, 2016
40f1b4e
Added support for amazon ami
varshneyjayant Apr 21, 2016
147ba9c
Merge pull request #6 from psquickitjayant/amazon-ami-support
varshneyjayant Apr 21, 2016
ad360ea
Merge pull request #5 from psquickitjayant/rsyslog-systemd
varshneyjayant May 4, 2016
File filter...
Filter file types
Jump to…
Jump to file
Failed to load files.

Always

Just for now

Added MaxMessageSize

  • Loading branch information
varshneyjayant committed Mar 9, 2016
commit 15dc9f7ce422fac58312ad97f44e2833b07e3d80
@@ -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.14
SCRIPT_VERSION=1.15

#application tag. This will get overwritten by the child script which calls this
APP_TAG=
@@ -118,7 +118,7 @@ checkLinuxLogglyCompatibility()

#checking if syslog-ng is configured as a service
checkifSyslogNgConfiguredAsService

#check if rsyslog is configured as service. If no, then exit
checkIfRsyslogConfiguredAsService

@@ -130,6 +130,9 @@ checkLinuxLogglyCompatibility()

#check if selinux service is enforced. if yes, ask the user to manually disable and exit the script
checkIfSelinuxServiceEnforced

#update rsyslog.conf and adds $MaxMessageSize in it
modifyMaxMessageSize

LINUX_ENV_VALIDATED="true"
}
@@ -158,7 +161,7 @@ installLogglyConf()
if [ "$IS_INVOKED" = "" ]; then
logMsgToConfigSysLog "SUCCESS" "SUCCESS: Linux system successfully configured to send logs via Loggly."
fi

}

#remove loggly configuration from Linux system
@@ -189,7 +192,7 @@ removeLogglyConf()
#checks if user has root privileges
checkIfUserHasRootPrivileges()
{
#This script needs to be run as a sudo user
#This script needs to be run as root
if [[ $EUID -ne 0 ]]; then
logMsgToConfigSysLog "ERROR" "ERROR: This script must be run as root."
exit 1
@@ -200,9 +203,9 @@ checkIfUserHasRootPrivileges()
checkIfSupportedOS()
{
getOs

LINUX_DIST_IN_LOWER_CASE=$(echo $LINUX_DIST | tr "[:upper:]" "[:lower:]")

case "$LINUX_DIST_IN_LOWER_CASE" in
*"ubuntu"* )
echo "INFO: Operating system is Ubuntu."
@@ -233,7 +236,7 @@ checkIfSupportedOS()
[Yy]* )
break;;
[Nn]* )
exit 1
exit 1
;;
* ) echo "Please answer yes or no.";;
esac
@@ -303,7 +306,7 @@ checkIfLogglyServersAccessible()
logMsgToConfigSysLog "ERROR" "ERROR: This is not a recognized subdomain. Please ask the account owner for the subdomain they signed up with."
exit 1
fi

echo "INFO: Checking if Gen2 account."
if [ $(curl -s --head --request GET $LOGGLY_ACCOUNT_URL/apiv2/customer | grep "404 NOT FOUND" | wc -l) == 1 ]; then
logMsgToConfigSysLog "ERROR" "ERROR: This scripts need a Gen2 account. Please contact Loggly support."
@@ -343,7 +346,7 @@ getAuthToken()
tokenstr=${tokenstr#*\"}

LOGGLY_AUTH_TOKEN=$tokenstr

logMsgToConfigSysLog "INFO" "INFO: Retrieved authentication token: $LOGGLY_AUTH_TOKEN"
fi
}
@@ -369,13 +372,13 @@ checkIfRsyslogConfiguredAsService()
logMsgToConfigSysLog "ERROR" "ERROR: $RSYSLOG_SERVICE is not present as service."
exit 1
fi

#checking if syslog-ng is running as a service
checkifSyslogNgConfiguredAsService

if [ $(ps -A | grep "$RSYSLOG_SERVICE" | wc -l) -eq 0 ]; then
logMsgToConfigSysLog "INFO" "INFO: $RSYSLOG_SERVICE is not running. Attempting to start service."
sudo service $RSYSLOG_SERVICE start
service $RSYSLOG_SERVICE start
fi
}

@@ -399,7 +402,7 @@ checkIfMultipleRsyslogConfigured()
#check if minimum version of rsyslog required to configure loggly is met
checkIfMinVersionOfRsyslog()
{
RSYSLOG_VERSION=$(sudo $RSYSLOGD -version | grep "$RSYSLOGD")
RSYSLOG_VERSION=$($RSYSLOGD -version | grep "$RSYSLOGD")
RSYSLOG_VERSION=${RSYSLOG_VERSION#* }
RSYSLOG_VERSION=${RSYSLOG_VERSION%,*}
RSYSLOG_VERSION=$RSYSLOG_VERSION | tr -d " "
@@ -415,12 +418,23 @@ checkIfSelinuxServiceEnforced()
isSelinuxInstalled=$(getenforce -ds 2>/dev/null)
if [ $? -ne 0 ]; then
logMsgToConfigSysLog "INFO" "INFO: selinux status is not enforced."
elif [ $(sudo getenforce | grep "Enforcing" | wc -l) -gt 0 ]; then
elif [ $(getenforce | grep "Enforcing" | wc -l) -gt 0 ]; then
logMsgToConfigSysLog "ERROR" "ERROR: selinux status is 'Enforcing'. Please disable it and start the rsyslog daemon manually."
exit 1
fi
}

#update rsyslog.conf and adds $MaxMessageSize in it
modifyMaxMessageSize()
{
if grep -q '$MaxMessageSize' "/etc/rsyslog.conf"; then
sed -i 's/.*$MaxMessageSize.*/$MaxMessageSize 64k/g' /etc/rsyslog.conf
else
sed -i '1 a $MaxMessageSize 64k' /etc/rsyslog.conf
fi
logMsgToConfigSysLog "INFO" "INFO: Modified \$MaxMessageSize to 64k in rsyslog.conf"
}

#check if authentication token is valid and then write contents to 22-loggly.conf file to /etc/rsyslog.d directory
checkAuthTokenAndWriteContents()
{
@@ -461,24 +475,24 @@ inputStr="
"
if [ -f "$LOGGLY_RSYSLOG_CONFFILE" ]; then
logMsgToConfigSysLog "INFO" "INFO: Loggly rsyslog file $LOGGLY_RSYSLOG_CONFFILE already exist."

STR_SIZE=${#inputStr}
SIZE_FILE=$(stat -c%s "$LOGGLY_RSYSLOG_CONFFILE")

#actual file size and variable size with same contents always differ in size with one byte
STR_SIZE=$(( STR_SIZE + 1 ))

if [ "$STR_SIZE" -ne "$SIZE_FILE" ]; then

logMsgToConfigSysLog "WARN" "WARN: Loggly rsyslog file /etc/rsyslog.d/22-loggly.conf content has changed."
if [ "$SUPPRESS_PROMPT" == "false" ]; then
while true;
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;
mv -f $LOGGLY_RSYSLOG_CONFFILE $LOGGLY_RSYSLOG_CONFFILE_BACKUP;
WRITE_SCRIPT_CONTENTS="true"
break;;
[Nn]* )
@@ -490,7 +504,7 @@ inputStr="
done
else
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;
mv -f $LOGGLY_RSYSLOG_CONFFILE $LOGGLY_RSYSLOG_CONFFILE_BACKUP;
WRITE_SCRIPT_CONTENTS="true"
fi
else
@@ -499,13 +513,13 @@ inputStr="
else
WRITE_SCRIPT_CONTENTS="true"
fi

if [ "$WRITE_SCRIPT_CONTENTS" == "true" ]; then

sudo cat << EOIPFW >> $LOGGLY_RSYSLOG_CONFFILE
cat << EOIPFW >> $LOGGLY_RSYSLOG_CONFFILE
$inputStr
EOIPFW

fi

}
@@ -517,13 +531,13 @@ createRsyslogDir()
logMsgToConfigSysLog "INFO" "INFO: $RSYSLOG_DIR already exist, so not creating directory."
if [[ "$LINUX_DIST" == *"Ubuntu"* ]]; then
logMsgToConfigSysLog "INFO" "INFO: Changing the permission on the rsyslog in /var/spool"
sudo chown -R syslog:adm $RSYSLOG_DIR
chown -R syslog:adm $RSYSLOG_DIR
fi
else
logMsgToConfigSysLog "INFO" "INFO: Creating directory $SYSLOGDIR"
sudo mkdir -v $RSYSLOG_DIR
mkdir -v $RSYSLOG_DIR
if [[ "$LINUX_DIST" == *"Ubuntu"* ]]; then
sudo chown -R syslog:adm $RSYSLOG_DIR
chown -R syslog:adm $RSYSLOG_DIR
fi
fi
}
@@ -577,7 +591,7 @@ checkIfLogsMadeToLoggly()
remove22LogglyConfFile()
{
if [ -f "$LOGGLY_RSYSLOG_CONFFILE" ]; then
sudo rm -rf "$LOGGLY_RSYSLOG_CONFFILE"
rm -rf "$LOGGLY_RSYSLOG_CONFFILE"
fi
}

@@ -603,7 +617,7 @@ compareVersions ()
restartRsyslog()
{
logMsgToConfigSysLog "INFO" "INFO: Restarting the $RSYSLOG_SERVICE service."
sudo service $RSYSLOG_SERVICE restart
service $RSYSLOG_SERVICE restart
if [ $? -ne 0 ]; then
logMsgToConfigSysLog "WARNING" "WARNING: $RSYSLOG_SERVICE did not restart gracefully. Please restart $RSYSLOG_SERVICE manually."
fi
@@ -666,9 +680,9 @@ sendPayloadToConfigSysLog()
searchAndFetch()
{
url=$2

result=$(wget -qO- /dev/null --user "$LOGGLY_USERNAME" --password "$LOGGLY_PASSWORD" "$url")

if [ -z "$result" ]; then
logMsgToConfigSysLog "ERROR" "ERROR: Please check your network/firewall settings & ensure Loggly subdomain, username and password is specified correctly."
exit 1
@@ -687,7 +701,7 @@ searchAndFetch()
eval $1="'$count'"
if [ "$count" -gt 0 ]; then
timestamp=$(echo "$result" | grep timestamp)
fi
fi
}

#get password in the form of asterisk
@@ -774,4 +788,4 @@ fi

########## Get Inputs from User - End ########## -------------------------------------------------------
# End of Syslog Logging Directives for Loggly
#
#
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.