Created
August 10, 2014 06:10
-
-
Save viktorbenei/35541c42b9d4f5f213aa to your computer and use it in GitHub Desktop.
Install Logentries agent on OS X
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
function print_and_do_command { | |
echo "-> $ $@" | |
$@ | |
} | |
function print_and_do_command_exit_on_error { | |
print_and_do_command $@ | |
if [ $? -ne 0 ]; then | |
echo " [!] Failed!" | |
exit 1 | |
fi | |
} | |
# | |
# Quickfix, because Logentries tries to use python2 instead of python (python2 is not available on OS X - python is actually python 2) | |
# | |
print_and_do_command_exit_on_error sudo ln -s /usr/bin/python /usr/bin/python2 | |
# this is the official Logentries install command | |
curl -O https://raw.githubusercontent.com/logentries/le/master/install/mac/install.sh && sudo sh install.sh | |
if [ $? -ne 0 ]; then | |
echo " [!] Failed to install Logentries agent" | |
fi | |
# for test just unload and re-load -> this should start to send data from the system log | |
print_and_do_command_exit_on_error sudo launchctl unload /Library/LaunchDaemons/com.logentries.agent.plist | |
print_and_do_command_exit_on_error sudo launchctl load /Library/LaunchDaemons/com.logentries.agent.plist | |
# | |
# you can register your additional log files with: | |
# $ sudo le follow path/to/the/file | |
# sudo is important, by the default logentries agent is started with sudo | |
# and if you try to add new log files without sudo it'll handle it as a separate, | |
# non-sudo logentries agent (meaning: will start a new agent and you have to start it as well as the sudo one) | |
# | |
# after the 'follow' of new log files you have to call: | |
# sudo launchctl unload /Library/LaunchDaemons/com.logentries.agent.plist && sudo launchctl load /Library/LaunchDaemons/com.logentries.agent.plist | |
# to start the monitoring | |
# you can add a quick test entry to the syslog with: | |
logger "logentries quick test" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment