Amphora-agent should log to a distinct location
This patch sets up a seperate log file for the amphora-agent and logrotate to manage this new log. Co-Authored-By: Adam Harwell <flux.adam@gmail.com> Co-Authored-By: Michael Johnson <johnsomor@gmail.com> Change-Id: Ia7b057642d7a567d685d989d1c689d5f3481e73e
This commit is contained in:
parent
264f3b58d1
commit
bf8aac5561
@ -1,4 +1,5 @@
|
|||||||
dib-init-system
|
dib-init-system
|
||||||
|
install-static
|
||||||
package-installs
|
package-installs
|
||||||
pip-and-virtualenv
|
pip-and-virtualenv
|
||||||
source-repositories
|
source-repositories
|
||||||
|
@ -7,6 +7,8 @@ Wants=syslog.service
|
|||||||
ExecStart=/usr/local/bin/amphora-agent --config-file /etc/octavia/amphora-agent.conf
|
ExecStart=/usr/local/bin/amphora-agent --config-file /etc/octavia/amphora-agent.conf
|
||||||
KillMode=mixed
|
KillMode=mixed
|
||||||
Restart=always
|
Restart=always
|
||||||
|
ExecStartPost=/bin/sh -c "echo $MAINPID > /var/run/amphora-agent.pid"
|
||||||
|
PIDFile=/var/run/amphora-agent.pid
|
||||||
|
|
||||||
[Install]
|
[Install]
|
||||||
WantedBy=multi-user.target
|
WantedBy=multi-user.target
|
||||||
|
@ -7,3 +7,12 @@ respawn
|
|||||||
respawn limit 2 2
|
respawn limit 2 2
|
||||||
|
|
||||||
exec amphora-agent --config-file /etc/octavia/amphora-agent.conf
|
exec amphora-agent --config-file /etc/octavia/amphora-agent.conf
|
||||||
|
|
||||||
|
post-start script
|
||||||
|
PID=`status amphora-agent | egrep -oi '([0-9]+)$' | head -n1`
|
||||||
|
echo $PID > /var/run/amphora-agent.pid
|
||||||
|
end script
|
||||||
|
|
||||||
|
post-stop script
|
||||||
|
rm -f /var/run/amphora-agent.pid
|
||||||
|
end script
|
||||||
|
12
elements/amphora-agent/static/etc/logrotate.d/amphora-agent
Normal file
12
elements/amphora-agent/static/etc/logrotate.d/amphora-agent
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
/var/log/amphora-agent.log {
|
||||||
|
daily
|
||||||
|
rotate 10
|
||||||
|
missingok
|
||||||
|
notifempty
|
||||||
|
compress
|
||||||
|
delaycompress
|
||||||
|
sharedscripts
|
||||||
|
postrotate
|
||||||
|
kill -s SIGUSR1 $(cat /var/run/amphora-agent.pid)
|
||||||
|
endscript
|
||||||
|
}
|
@ -77,8 +77,8 @@ def main():
|
|||||||
'ca_certs': CONF.amphora_agent.agent_server_ca,
|
'ca_certs': CONF.amphora_agent.agent_server_ca,
|
||||||
'cert_reqs': True,
|
'cert_reqs': True,
|
||||||
'preload_app': True,
|
'preload_app': True,
|
||||||
'accesslog': '-',
|
'accesslog': '/var/log/amphora-agent.log',
|
||||||
'errorlog': '-',
|
'errorlog': '/var/log/amphora-agent.log',
|
||||||
'loglevel': 'debug',
|
'loglevel': 'debug',
|
||||||
}
|
}
|
||||||
AmphoraAgent(server_instance.app, options).run()
|
AmphoraAgent(server_instance.app, options).run()
|
||||||
|
Loading…
Reference in New Issue
Block a user