Created
February 6, 2018 17:18
-
-
Save kunanit/2b2515cc418afcea201086a2ccdbf760 to your computer and use it in GitHub Desktop.
Elastic Beanstalk .ebextensions config file that ensures awslogs agent monitors newest log file created on deploy
This file contains 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
# 99_delete_awslogs_agent_state.sh: deletes awslogs agent state file so that | |
# agent starts monitoring logs for the most recently created container | |
files: | |
/opt/elasticbeanstalk/hooks/appdeploy/post/99_delete_awslogs_agent_state.sh: | |
mode: "000755" | |
owner: root | |
group: root | |
content: | | |
#!/bin/bash | |
# delete awslogs agent state file so that agent starts monitoring logs | |
# for the most recently created container | |
AGENTSTATE="/var/lib/awslogs/agent-state" | |
if [ -e $AGENTSTATE ] | |
then | |
sudo rm $AGENTSTATE | |
sudo service awslogs restart | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment