Skip to content

Error Message: When selecting the WAF log data source in OpenSearch Dashboards, the error "Failed to fetch log groups" occurs.

0

Current Setup:

  • Created WAF log datasource in CloudWatch Logs Insights
  • Configured Amazon OpenSearch Service integration
  • IAM roles and permissions configured for access

Symptoms:

  1. OpenSearch applications: "Failed to fetch log groups" error when selecting WAF log datasource
  2. CloudWatch Logs Insights to OpenSearch dashboards: "Dashboard metadata failed to load. no such index [flint_cloudwatch_logs_96126610_default_waf]"

Environment Information:

AWS Region: eu-central-1 OpenSearch Version: OpenSearch_2_17_R20241112-P4 (latest)

Troubleshooting Steps Taken:

  1. Verified and added CloudWatch Logs permissions (logs:*)
  2. Added OpenSearch permissions (es:*)
  3. Added OpenSearch Serverless permissions (aoss:*)
  4. Set resource access to "*"

Expected Behavior:

  • Should be able to view WAF logs in OpenSearch dashboards
  • Should be able to query log groups without errors

Questions:

  1. Are there additional permissions required?
  2. Is there any index configuration needed?
  3. What's the recommended setup for WAF logs visualization in OpenSearch?
2 Answers
1

Hi,

Do you know that you can analyze your WAF logs now directly in CloudWatch with Logs Insights, Contributor Insights and Metric Filters ?

See https://aws.amazon.com/blogs/mt/analyzing-aws-waf-logs-in-amazon-cloudwatch-logs/ for all details.

To answer your question more directly, the full setup of WAL log analysis and query with OpenSearch is fully detailled in this blog post: https://aws.amazon.com/blogs/security/analyze-aws-waf-logs-using-amazon-opensearch-service-anomaly-detection-built-on-random-cut-forests/

You probably want to follow the sections detailing the configuration of WAF and OpenSearch to see if your setup matches those.

Update: to answer follow up question on Centralized Logging

Best,

Didier

EXPERT
answered a year ago
EXPERT
reviewed a year ago
  • Hi Didier, Thank you for your suggestions. Since we aim to integrate AWS WAF logs into the OpenSearch service dashboard, we need further assistance. While we have referred to the blog article you provided, we still encountered some challenges during the setup process. Could you provide more detailed guidance or recommend other resources to ensure we successfully integrate WAF logs into OpenSearch?

    Currently, the OpenSearch service indicates that it can directly read CloudWatch log data. It seems like we don’t need to use Lambda and Kinesis as intermediaries to transfer the data. Or did I misunderstand this?

    Additionally, we noticed that AWS offers a solution called "Centralized Logging with OpenSearch," which helps organizations collect, process, and visualize log data from various sources using Amazon OpenSearch Service. This might be helpful for our needs.

    We hope to successfully integrate WAF logs into OpenSearch and effectively analyze and monitor them through the service dashboard.

    Best,

    Ziv

  • Hi Ziv, can you detail the challenges you face or corresponding errors? Hard to help further otherwise

  • Ziv, I updated my answer with centralized logging pointers. Didier

  • Hi Didier

    I would like to use the Connected data sources feature in Amazon OpenSearch Service. Currently, this feature can only directly fetch WAF logs from CloudWatch Logs. I have not configured any Lambda functions to establish a connection between OpenSearch Service and CloudWatch Logs.

    I only created a CloudWatch Logs dashboard from the OpenSearch Service console. However, the dashboard displays errors such as "Failed to fetch log groups" and "Failed to load. No such index [flint_cloudwatch_logs_96126610_default_waf]."

    I would like to confirm if there is anything wrong with my configuration.

    Thank you!

    Best,

    Ziv

1

Based on the information provided, it seems you're experiencing issues with integrating AWS WAF logs into OpenSearch Dashboards. Let's address your questions and provide some recommendations:

  1. Additional permissions: While you've added broad permissions for CloudWatch Logs, OpenSearch, and OpenSearch Serverless, it's important to ensure that the IAM role associated with your OpenSearch cluster has specific permissions to access the WAF log groups. Make sure the IAM role has permissions to describe and read from the WAF log groups in CloudWatch Logs.

  2. Index configuration: The error message mentioning "no such index [flint_cloudwatch_logs_96126610_default_waf]" suggests that the required index for WAF logs hasn't been created or is misconfigured. This index is typically created automatically when setting up the integration, but you may need to verify its existence and configuration in OpenSearch.

  3. Recommended setup for WAF logs visualization: To properly set up WAF logs visualization in OpenSearch:

a. Ensure your WAF logs are being published to CloudWatch Logs. The log group name should start with "aws-waf-logs-".

b. In the OpenSearch Service console, create a data source for CloudWatch Logs if you haven't already.

c. Use the pre-built dashboard feature for AWS WAF logs. In the OpenSearch Service console, go to the "Analyze with OpenSearch" tab, choose "Settings", and follow the steps to create an OpenSearch dashboard.

d. When creating the dashboard, select "AWS WAF logs" as the automatic dashboard type.

e. Configure the data synchronization frequency (e.g., every 15 minutes) and select the appropriate WAF log groups.

f. Create the dashboard and wait for it to be generated.

Additional troubleshooting steps:

  1. Verify that the log group name starts with "aws-waf-logs-" in CloudWatch Logs.

  2. Check that you have the required permissions to publish logs to CloudWatch Logs and access them from OpenSearch.

  3. Ensure the log group has a resource policy with the necessary permissions.

  4. In the OpenSearch Discover page, try using the direct query data source to query your CloudWatch Logs log groups. Use the search bar to build your query using SQL or PPL.

  5. If the issue persists, you may want to check for any service quotas or limits that might be affecting the integration.

By following these steps and ensuring proper configuration, you should be able to visualize and analyze your WAF logs in OpenSearch Dashboards without encountering the mentioned errors.
Sources
Troubleshoot issues when I publish AWS WAF logs to a destination | AWS re:Post
Configuring and querying a CloudWatch Logs data source in OpenSearch Dashboards - Amazon OpenSearch Service
New Amazon CloudWatch and Amazon OpenSearch Service launch an integrated analytics experience | AWS News Blog
Troubleshoot a CloudWatch Logs Insights query that returns errors | AWS re:Post

answered a year ago
EXPERT
reviewed a year 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.