0

I have mysqld_node running on my mysql server to get statistics to be used by grafana + prometheus to graph dashboard for this MySQL server. However, i noticed that 90% of the queries in my slow query logs are created by mysqld_node, and hence hard to filter queries from Application servers. Is there a way to block queries from being logged in the slow query logged based on the port or some other criteria? The port for mysqld_node is 9104.

  • @danblack Thats not what i am trying to achieve. I want to block queries coming from a certain application e.g., app running on port 9104 to have it's queries not logged in the slow query logs regardless of their running time. – giogio Apr 1 at 4:33
  • What MySQL version? Why mysql slow query log settings? There's no way mysql can know what port the app is running on. Is the mysqld_node application running on its own mysql user? What GRANTs does that user have? – danblack Apr 1 at 4:39
  • 5.7. mysqld_node is running locally on the same server as the MySQL DB server. GRANT SELECT, RELOAD, PROCESS, SUPER, LOCK TABLES, EXECUTE, REPLICATION SLAVE, REPLICATION CLIENT, SHOW VIEW, EVENT, TRIGGER ON . – giogio Apr 1 at 4:46
  • The only way of doing a user based configuration is via init_connect, which doesn't apply to SUPER users. Changing the mysqld_node is still the best option in my experience and I'd suggest writing a bug report for it. I assume you know grafana/prometheus enough to know if there's a filtering option there. – danblack Apr 1 at 4:54
  • I will just stop mysqld_node for a period of time, remove the current slow query log, then create a new one to gather queries, and finally analyze these queries minus the mysqld_node queries. Thats what i have always done. But just wanted to know if there is a way to do it without always having to stop mysqld_node. – giogio Apr 1 at 5:00
0

long_query_time is a session variable and could be set to a large value in the mysqld_node code.

0
  • Turn off log_queries_not_using_indexes (it's virtually useless anyway), or turn on log_throttle_queries_not_using_indexes (if your version has such; what version are you using?).

  • Use a pt-query-digest or mysqldumpslow -s t to filter the slow log down to 'actionable' info.

  • Cycle the slowlog.

  • What is mysql_node?

  • If mysql_node is a single user, then have it's init_connect turn off logging (or set long_query_time to a high value). (This assumes it is not SUPER.)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.