High CPU usage, low memory usage on Mariadb 10.5.8 -- SQL tuner complaining about memory, performance seems fine I'm hoping to get some friendly advice how to proceed with optimizing this server.
VM:
8vCPU - 2.6GHz
32GB mem
Disk speed
~3Gbps (380MBps)

Application is Librenms
my.cnf.d/server.cnf  -- Built from template somewhere on github
mysqltuner.pl output
The server currently idles at around 500% cpu with Mariadb being the culprit
sar -q output
free -m output
Increase innodb_buffer_pool_size to be about 70% of available RAM.
High CPU implies poor indexing and/or poor query formulation.  Let's see some queries and the matching SHOW CREATE TABLE.
 INDEX(`rule_id`,`device_id`,`state`)  -- handles the following:
 INDEX(`rule_id`,`device_id`)   -- DROP
 INDEX(`rule_id`)   -- DROP

Add
 INDEX(state, time_logged)

Shrink INTs to some smaller datatype.  Saving space speeds up the query a little.
Invert the query -- Find the 50 rows, then do the JOINs:
SELECT ...
    FROM (
        SELECT id FROM log
            WHERE ...
            ORDER BY  time_logged DESC
            LIMIT  0,50
         )
    JOIN log AS e USING(id)  -- to get other columns from log
    JOIN the other tables for the other columns
    ORDER BY  time_logged DESC  -- repeat if ORDER matters

Use pt-query-digest to summarize the slowlog; it will be easier to spot the &quot;worst&quot; queries.
Other issues...

max_connections = 200000 is ridiculously high, even dangerously high.  That is the number of &quot;connections&quot; to allow at any one time.  RAM is consumed for each connection.  Do SHOW GLOBAL STATUS LIKE 'Max_used_connections'; to see that you have not come anywhere near that value.  100 is a safe starting value until you have a reason to increase it.
Notice (in slowlog) Rows_examined: 973090.  How many rows in each of the tables?  The changes I suggest will probably bring that number down, though probably not down to the optimal of 50 (as in Rows_sent: 50).
An owl can turn its head almost all the way around.  That is how my head feels when I see a LEFT JOIN and RIGHT JOIN in the same statement.  My head would appreciate it if you could turn that RIGHT JOIN into a suitable LEFT JOIN or, if appropriate, INNER JOIN.  In particular, in the queries with AND  R.severity &gt;= 2, it really is an INNER JOIN.