Details
-
Improvement
-
Resolution: Not A Bug
-
Major
-
None
-
Community Edition
-
Centos8
apache2
php 7.2
MariaDB 10.3.17
Description
When calling uri /syslog/ we get always a timeout because of very slow mysql query.
I think I found the reason:
in html/pages/syslog.inc.php in line 43 you have:
$query_devices = generate_query_values($form_devices, 'device_id');
which results in a very large device list (in our case 300 devices).
so when page isn't called with a device_id as parameter it goes to mysql in
dbFetchColumn('SELECT DISTINCT `program` FROM `syslog` WHERE 1 ' . $query_devices);
(line 73)
and makes a long query which can timeout. IMHO there is absolute no need for this because this isn't used when no device_id is set.
so changing line 43 to
$query_devices = '';
results in a much faster query. When no Dev-ID is given then we WANT all programs and there is no need for a "device_id in (...)" selector. But when selecting some devices it gets the correct $query_devices (which is mostly faster because in most cases only some are selected)
So I think you should simply set default $query_devices string to an empty string.
Rajko
Ok, thought twice: I understand when pre-filter is required (limited users, disabled devices etc) it is needed so my idea isn't good.
So please ignore this (I can not close it myself) I'll check some other possiblities