Skip to content

Instantly share code, notes, and snippets.

@kunanit
Created February 6, 2018 17:18
Show Gist options
  • Save kunanit/2b2515cc418afcea201086a2ccdbf760 to your computer and use it in GitHub Desktop.
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
# 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