pmm-client rsync-ed slowlog

Hi! i want to run a copy of pmm-client, enabling only mysql:queries (qan).

Because I am unable to run pmm-client on the same host as MySQL, I am rsyncing the slowlog over to /var/lib/mysql/slow.log in my pmm-client server (debian).

I wish to specify the slowlog file for pmm-client to use, however I keep getting prompted for mysql creds, so I entered those as it asked:

# pmm-admin add mysql:queries --query-source slowlog --slow-log-rotation false --host 10.0.2.2 --port 32773 --user root --password my-secret-pw mysql 
OK, now monitoring MySQL queries from slowlog using DSN root:***@tcp(10.0.2.2:32773)

# pmm-admin list
pmm-admin 1.11.0

PMM Server | 10.0.2.2:8080 
Client Name | debian-utility-vm
Client Address | 172.17.0.1 
Service Manager | linux-systemd

-------------- ------- ----------- -------- ----------------------------- --------------------------------------------------------------------------------------
SERVICE TYPE NAME LOCAL PORT RUNNING DATA SOURCE OPTIONS 
-------------- ------- ----------- -------- ----------------------------- --------------------------------------------------------------------------------------
mysql:queries false - YES root:***@tcp(10.0.2.2:32773) query_source=slowlog, query_examples=true, slow_log_rotation=true, retain_slow_logs=1 

Despite having /var/lib/mysql/slow.log in-place. I can see these logs:

# tail -f /var/log/pmm-mysql-queries-0.log 
2018/06/21 11:01:00.026600 WARNING qan-interval stat /var/lib/mysql/6217cce50e2a-slow.log: no such file or directory
2018/06/21 11:02:00.030392 WARNING qan-interval stat /var/lib/mysql/6217cce50e2a-slow.log: no such file or directory
2018/06/21 11:03:00.024187 WARNING qan-interval stat /var/lib/mysql/6217cce50e2a-slow.log: no such file or directory
2018/06/21 11:04:00.020316 WARNING qan-interval stat /var/lib/mysql/6217cce50e2a-slow.log: no such file or directory
2018/06/21 11:05:00.020676 WARNING qan-interval stat /var/lib/mysql/6217cce50e2a-slow.log: no such file or directory
2018/06/21 11:06:00.020533 WARNING qan-interval stat /var/lib/mysql/6217cce50e2a-slow.log: no such file or directory
2018/06/21 11:07:00.019434 WARNING qan-interval stat /var/lib/mysql/6217cce50e2a-slow.log: no such file or directory
2018/06/21 11:08:00.033935 WARNING qan-interval stat /var/lib/mysql/6217cce50e2a-slow.log: no such file or directory
2018/06/21 11:09:00.018048 WARNING qan-interval stat /var/lib/mysql/6217cce50e2a-slow.log: no such file or directory
2018/06/21 11:10:00.018248 WARNING qan-interval stat /var/lib/mysql/6217cce50e2a-slow.log: no such file or directory

How is the pmm-client slowlog file chosen? Can I specify the slowlog file to analyze? When specifying

--query-source slowlog

, where does pmm-client look for the slowlog file?

My guess is that the

slow_query_log_file

mysql variable is used to determine the filename, but searching through the pmm-client code on github I haven’t been able to confirm that - is this true?

mysql> show variables like "slow_query_log_file";
+---------------------+--------------------------------------+
| Variable_name | Value |
+---------------------+--------------------------------------+
| slow_query_log_file | /var/lib/mysql/6217cce50e2a-slow.log |
+---------------------+--------------------------------------+
1 row in set (0.01 sec)

must be

Instead of doing this rsync jive, I think i’m going to fork qan-agent to do what I need and rebuild pmm-client.

Why do not you use Performance Schema as data source in this case ? It can work with remote host.

Good suggestion, I agree. Members of my team believe that the slowlog will give us extra info and, additionally, the overhead to write to slowlog file may be less than the overhead to write to perfschema.

Thankfully, percona makes pmm-client and qan-agent available as OSS :slight_smile: so I’m modifying them to meet my needs.