Skip to content

AWS RDS PostgreSQL Database Insights 'Slow Queries' Tab Error: MalformedQueryException

2

Two weeks ago, we enabled Database Insights – Advanced on our Amazon RDS for PostgreSQL instance. Initially, the Database Telemetry > Slow Queries tab functioned correctly. However, starting last week, accessing this tab results in the following error:​

Your logs could not be fetched
unexpected symbol found [ at line 2 and position 2
(Service: AWSLogs; Status Code: 400; Error Code: MalformedQueryException;
Request ID: ef9ee8a5-b7c2-4000-acad-d7df9ba97973; Proxy: null)

This issue persists regardless of the selected time range. As I recall, we didn't make any change in parameter groups. Also​, CloudWatch Logs shows slow queries with "duration" pattern correctly. Has anyone else experienced this issue? Could this be related to some recent changes in AWS's internal handling of log queries that we are not aware?

Regards

  • same too, how to fix it?

  • Currently, we don't have the same necessity for this feature as we did before, so I disabled the feature for now. Neither of the options suggested in the AI-generated response below resolved the issue, so the best course now I believe is to open a support ticket to AWS.

1 Answer
-1

The issue you're experiencing with the 'Slow Queries' tab in Database Insights for your Amazon RDS PostgreSQL instance is concerning, especially since it was working correctly initially. While it's difficult to pinpoint the exact cause without more information, there are a few things to consider:

  1. Configuration Check: Even though you don't recall making changes to the parameter group, it's worth double-checking your database configuration. Ensure that the necessary parameters for slow query logging are still correctly set. For RDS PostgreSQL, these parameters typically include:

    • log_min_duration_statement: Should be set to 1 or your desired threshold
    • log_statement: Should be set to 'none'
    • log_destination: Should be set to 'stderr'
  2. Log Exports: Verify that log exports to CloudWatch Logs are still enabled and functioning correctly. The fact that you can see slow queries in CloudWatch Logs is a good sign, but it's worth confirming that all necessary log types are being exported.

  3. CloudWatch Logs Insights: Since the slow queries are visible in CloudWatch Logs, you might be able to use CloudWatch Logs Insights as a temporary workaround to query and analyze your slow queries while this issue persists.

  4. AWS Service Issue: The error message you're receiving (MalformedQueryException) suggests there might be an issue with how AWS is processing the log query for the Slow Queries tab. This could potentially be related to recent changes in AWS's internal handling of log queries, as you suggested.

  5. Support Case: If the issue persists after verifying your configuration, it would be advisable to open a support case with AWS. They would be able to investigate if there are any known issues or recent changes that could be affecting the Slow Queries tab functionality.

  6. Temporary Fix: Some users have reported success in resolving similar issues by disabling and then re-enabling Performance Insights at the cluster level, followed by rebooting the instances. While this isn't guaranteed to work, it might be worth trying if the issue continues.

Remember to monitor your database performance closely while troubleshooting this issue, as any changes to logging parameters can potentially impact performance.
Sources
Configuring your database to monitor slow SQL queries with Database Insights for Amazon Aurora - Amazon Aurora
Configuring your database to monitor slow SQL queries with Database Insights for Amazon RDS - Amazon Relational Database Service
Performance Insights in RDS can't show the call/sec, Avg latency (ms)/call... | AWS re:Post

answered 7 months ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.