Skip to content

Commit

Permalink
feat: Add logrotate script and update log location (#1963)
Browse files Browse the repository at this point in the history
Write to /var/log/proxysql.log by default, and add a logrotate script
which manages this path.

Unfortunately, the logrotate script can't use `PROXYSQL FLUSH LOGS;` to
tell ProxySQL to rotate file handles*, so we use copytruncate instead.
It would be nice if ProxySQL could rotate file handles following a
signal in future...

* For two reasons:
1. There's no safe / standard way to find admin credentials
2. mysql(1) client may not be installed
  • Loading branch information
alexjurkiewicz authored and Nick Vyzas committed Mar 20, 2019
1 parent 905d05f commit ee219f4
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ Architecture: amd64
# Readme: README.md
Files: proxysql /usr/bin/
etc/proxysql.cnf /etc/
etc/logrotate.d/proxysql /etc/logrotate.d/proxysql
systemd/system/proxysql.service /lib/systemd/system/
tools/proxysql_galera_checker.sh /usr/share/proxysql/tools/
tools/proxysql_galera_writer.pl /usr/share/proxysql/tools/
Expand Down
1 change: 1 addition & 0 deletions docker/images/proxysql/deb-compliant/ctl/proxysql.ctl
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ Architecture: amd64
# Readme: README.md
Files: proxysql /usr/bin/
etc/proxysql.cnf /
etc/logrotate.d/proxysql /etc/logrotate.d/proxysql
systemd/system/proxysql.service /lib/
tools/proxysql_galera_checker.sh /usr/share/proxysql/
tools/proxysql_galera_writer.pl /usr/share/proxysql/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ Architecture: amd64
# Readme: README.md
Files: proxysql /usr/bin/
etc/proxysql.cnf /
etc/logrotate.d/proxysql /etc/logrotate.d/proxysql
etc/init.d/proxysql /
tools/proxysql_galera_checker.sh /usr/share/proxysql/
tools/proxysql_galera_writer.pl /usr/share/proxysql/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,10 @@ rm -rf /var/run/%{name}
%defattr(-,root,root,-)
%config(noreplace) %{_sysconfdir}/%{name}.cnf
%attr(640,root,%{name}) %{_sysconfdir}/%{name}.cnf
%config(noreplace) %attr(640,root,%{name}) %{_sysconfdir}/logrotate.d/%{name}
%{_bindir}/*
%{_sysconfdir}/init.d/%{name}
/usr/share/proxysql/tools/proxysql_galera_checker.sh
/usr/share/proxysql/tools/proxysql_galera_writer.pl

%changelog

5 changes: 5 additions & 0 deletions etc/logrotate.d/proxysql
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
/var/log/proxysql.log {
missingok
notifempty
copytruncate
}
1 change: 1 addition & 0 deletions etc/proxysql.cnf
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
########################################################################################

datadir="/var/lib/proxysql"
errorlog="/var/log/proxysql.log"

admin_variables=
{
Expand Down

0 comments on commit ee219f4

Please sign in to comment.