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

Enhancements #71

Merged
merged 53 commits into from May 13, 2015
Merged
Changes from 1 commit
Commits
Show all changes
53 commits
Select commit Hold shift + click to select a range
3a59a73
Added support to Debian OS
Oct 27, 2014
7210c7d
Added a check for syslog-ng
Oct 28, 2014
b782617
Check if logs are parsed in Loggly
Oct 28, 2014
ca64536
Check if logs are parsed in Loggly
Oct 28, 2014
c217c36
Check if logs are parsed in Loggly
Oct 28, 2014
c60835a
Added support to suppress prompts
Oct 31, 2014
c53de77
Added support to suppress prompts
Oct 31, 2014
995d96a
Added support to suppress prompts
Oct 31, 2014
ac4f3f1
Added support to suppress prompts
Oct 31, 2014
8ea9e55
Added support to suppress prompts
Oct 31, 2014
6e316ad
Added support to suppress prompts
Oct 31, 2014
32cb0b8
Linux Script: Minor Bug Fix
Oct 31, 2014
743fc92
Linux Script: Bug Fix
Nov 4, 2014
48e750b
File Monitoring: Check if logs are rotated.
Nov 6, 2014
1afae10
File Monitoring: Check if logs are rotated.
Nov 11, 2014
bdddbb0
Updated Mac logs link
Nov 12, 2014
ee39dc6
Checks if log rotation is enabled on the File
Nov 20, 2014
76af2ad
Checks if log rotation is enabled on the Log files
Nov 20, 2014
65e3be8
Checks if log rotation is enabled on the Log files
Nov 20, 2014
8aff0e5
Minor modifications
Nov 21, 2014
9d3f561
Minor modifications
Nov 21, 2014
25754be
Minor modifications
Nov 21, 2014
33d993d
Added support to multiple tags
Nov 25, 2014
75c172c
Added support to multiple tags
Nov 25, 2014
f8a92a1
Added support to multiple tags
Nov 25, 2014
e083b05
Added support to multiple tags
Nov 26, 2014
5b59acb
Linux Script: Bug Fixes.
Dec 2, 2014
4669afc
Removed Log Rotation Check
Dec 2, 2014
8e33628
Removed Log Rotation Check
Dec 2, 2014
b907287
Removed Log Rotation Check
Dec 2, 2014
245c946
Bug Fixes
Dec 3, 2014
0f2b748
Bug Fixes
Dec 3, 2014
2d26c06
Remove state files on same alias
Dec 15, 2014
d642646
Bug Fixes
varshneyjayant Jan 21, 2015
c382fc1
Added troubleshooting rsyslog link
varshneyjayant Jan 23, 2015
4a6fba1
Added troubleshooting rsyslog link
varshneyjayant Jan 23, 2015
352212d
Revert "Added troubleshooting rsyslog link"
Jan 23, 2015
af0be39
Revert "Added troubleshooting rsyslog link"
Jan 23, 2015
b67a2c8
Added rsyslog troubleshooting link
Jan 23, 2015
95cb2ab
Added support to Disk Assisted queues
varshneyjayant Mar 4, 2015
bf14a8e
Added support to Directory Monitoring
varshneyjayant Mar 4, 2015
884113e
Added Mac Script
Mar 4, 2015
ded22fe
Added README
varshneyjayant Mar 4, 2015
3215989
Bug Fixes
Mar 18, 2015
62fce97
Bug fixes for syslog-ng detection
varshneyjayant Mar 24, 2015
164b2f4
Improved syslog-ng detection
varshneyjayant Mar 27, 2015
2a44bab
Improved error text
Mar 27, 2015
074e02a
Bug Fixes
varshneyjayant Apr 3, 2015
35cda1c
version number update from 1.0 to 1.1
varshneyjayant Apr 22, 2015
9afecfa
version number update from 1.12 to 1.13
varshneyjayant Apr 22, 2015
271d3cd
checks if cron is running during rollback
varshneyjayant Apr 22, 2015
6da5dad
Added script to publish on S3
varshneyjayant May 6, 2015
4d7af77
Updated Manual instructions
varshneyjayant May 6, 2015
File filter...
Filter file types
Jump to…
Jump to file
Failed to load files.

Always

Just for now

Added support to Disk Assisted queues

  • Loading branch information
varshneyjayant committed Mar 4, 2015
commit 95cb2ab9f962a0aba1e0bcef13fd47d30d8bd86a
@@ -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.10
SCRIPT_VERSION=1.12

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

#if all the above check passes, write the 22-loggly.conf file
write22LogglyConfFile
checkAuthTokenAndWriteContents

#create rsyslog dir if it doesn't exist, Modify the permission on rsyslog directory if exist on Ubuntu
createRsyslogDir
@@ -416,23 +416,10 @@ checkIfSelinuxServiceEnforced()
fi
}

#write 22-loggly,conf file to /etc/rsyslog.d directory after checking with user if override is needed
write22LogglyConfFile()
{
echo "INFO: Checking if loggly sysconf file $LOGGLY_RSYSLOG_CONFFILE exist."
if [ -f "$LOGGLY_RSYSLOG_CONFFILE" ]; then
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
fi
}

#check if authentication token is valid and then write contents to 22-loggly.conf file to /etc/rsyslog.d directory
checkAuthTokenAndWriteContents()
{
if [ "$LOGGLY_ACCOUNT" != "" ]; then
if [ "$LOGGLY_AUTH_TOKEN" != "" ]; then
writeContents $LOGGLY_ACCOUNT $LOGGLY_AUTH_TOKEN $LOGGLY_DISTRIBUTION_ID $LOGS_01_HOST $LOGGLY_SYSLOG_PORT
restartRsyslog
else
@@ -441,57 +428,12 @@ 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%\n\""
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 /etc/rsyslog.d/22-loggly.conf content has changed."
if [ "$SUPPRESS_PROMPT" == "false" ]; then
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
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;
fi
else
LINUX_DO_VERIFICATION="false"
fi

}

#write the contents to 22-loggly.conf file
writeContents()
{

WRITE_SCRIPT_CONTENTS="false"
inputStr="
# -------------------------------------------------------
# Syslog Logging Directives for Loggly ($1.loggly.com)
@@ -500,16 +442,67 @@ inputStr="
# Define the template used for sending logs to Loggly. Do not change this format.
\$template LogglyFormat,\"<%pri%>%protocol-version% %timestamp:::date-rfc3339% %HOSTNAME% %app-name% %procid% %msgid% [$2@$3] %msg%\n\"
\$WorkDirectory /var/spool/rsyslog # where to place spool files
\$ActionQueueFileName fwdRule1 # unique name prefix for spool files
\$ActionQueueMaxDiskSpace 1g # 1gb space limit (use as much as possible)
\$ActionQueueSaveOnShutdown on # save messages to disk on shutdown
\$ActionQueueType LinkedList # run asynchronously
\$ActionResumeRetryCount -1 # infinite retries if host is down
# Send messages to Loggly over TCP using the template.
*.* @@$4:$5;LogglyFormat
# -------------------------------------------------------
# End of Syslog Logging Directives for Loggly
# -------------------------------------------------------
# -------------------------------------------------------
"
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;
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;
WRITE_SCRIPT_CONTENTS="true"
break;;
[Nn]* )
LINUX_DO_VERIFICATION="false"
logMsgToConfigSysLog "INFO" "INFO: Skipping Linux verification."
break;;
* ) echo "Please answer yes or no.";;
esac
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;
WRITE_SCRIPT_CONTENTS="true"
fi
else
LINUX_DO_VERIFICATION="false"
fi
else
WRITE_SCRIPT_CONTENTS="true"
fi

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

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

fi

}

#create /var/spool/rsyslog directory if not already present. Modify the permission of this directory for Ubuntu
@@ -774,4 +767,6 @@ else
IS_INVOKED="true"
fi

########## Get Inputs from User - End ##########
########## 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.