Write queries with Gemini assistance

This document describes how you can use natural language prompts to generate SQL queries for VPC Flow Logs. To generate SQL queries for VPC Flow Logs, you interact with Gemini Cloud Assist in Flow Analyzer.

Learn how and when Gemini for Google Cloud uses your data.

Before you begin

Generate a SQL query

To interact with Gemini Cloud Assist, use the pen_sparkCompose a Cloud Assist Query prompt field. In the prompt field, you can enter a prompt or select a predefined prompt. The following table provides examples of prompts that you can use.

Prompt Generated SQL query
Show me cross-zonal traffic Selects flows where the source and destination are in different zones.
Show me resources with SSH traffic Selects flows with SSH traffic.
Show me the top 10 VMs with the highest traffic Selects 10 VMs with the highest number of bytes sent.
Show me traffic from and to 10.10.0.10 Selects flows where 10.10.0.10 is the source or destination IP address.
Show me traffic from example-instance to the internet Selects flows from the source VM instance named example-instance to the internet.
Show me traffic from gateways within the last three days Selects flows within the last three days where VLAN attachments for Cloud Interconnect and Cloud VPN tunnels are the source.

To generate and run a SQL query, do the following:

  1. In the Google Cloud console, go to the Flow Analyzer page.

    Go to Flow Analyzer

  2. Click pen_sparkCompose a Cloud Assist Query.

  3. Describe the log data that you want to view or select a predefined prompt.

  4. Click Generate SQL.

  5. Review the response and run the query:

    • To run the query in Flow Analyzer, click the Explore in Flow Analyzer tab and then click Open in Flow Analyzer.
    • To run the query in Log Analytics, click the Run SQL in Log Analytics tab and then click Run SQL in Log Analytics.

After you run the query, you can optionally modify the populated values as needed.

What's next