Is there a way to analyze SQL Slow query logs easily on log explorer or on some other GCP tool? Now log explorer writes log entries to multiple lines (textPayload divided) and it's hard to find out those slow performing queries.
So far I managed to get this, by help of article here (I think that article is outdated):
To easily analyze query logs, you can create a log-based metrics with the use of Cloud Monitoring.
Basically, you would need to do the following:
Start by filtering the Cloud Logging view to match the logs you want to measure
Create the log-based metric
Generate new data and view the new metric
Check this article for a more detailed steps.
I reproduced your issue and yes you are correct, Cloud SQL MySQL log (general.log, slow.log) in Log Explorer shows up spitted by newline into multiple records and does not show the long queries as one record.
Reason : This is because there's a newline character in the input Query that is set to Cloud SQL. If the input query is single-line (does not contain \n), the output will be one log event, showing as one line in Log Explorer. If the input query is multi-line (contains \n), the output will be multiple log events and showing up as multiple logs. the records that they see in the general log are split into multiple records.
To let you know, this issue is already known to Google. There are no ETAs for its implementation. All communication/updates from the Cloud SQL Team regarding this feature request will be posted here or here