Merge "Amphora-agent should log to a distinct location"

This commit is contained in:
Jenkins 2016-12-19 18:54:25 +00:00 committed by Gerrit Code Review
commit e24e3934c2
5 changed files with 26 additions and 2 deletions

View File

@ -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

View File

@ -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

View File

@ -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

View 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
}

View File

@ -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()