:doc:`CloudWatchLogs <../../logs>` / Client / list_log_groups_for_query

*************************
list_log_groups_for_query
*************************



.. py:method:: CloudWatchLogs.Client.list_log_groups_for_query(**kwargs)

  

  Returns a list of the log groups that were analyzed during a single CloudWatch Logs Insights query. This can be useful for queries that use log group name prefixes or the ``filterIndex`` command, because the log groups are dynamically selected in these cases.

   

  For more information about field indexes, see `Create field indexes to improve query performance and reduce costs <https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/CloudWatchLogs-Field-Indexing.html>`__.

  

  See also: `AWS API Documentation <https://docs.aws.amazon.com/goto/WebAPI/logs-2014-03-28/ListLogGroupsForQuery>`_  


  **Request Syntax**
  ::

    response = client.list_log_groups_for_query(
        queryId='string',
        nextToken='string',
        maxResults=123
    )
    
  :type queryId: string
  :param queryId: **[REQUIRED]** 

    The ID of the query to use. This query ID is from the response to your `StartQuery <https://docs.aws.amazon.com/AmazonCloudWatchLogs/latest/APIReference/API_StartQuery.html>`__ operation.

    

  
  :type nextToken: string
  :param nextToken: 

    The token for the next set of items to return. The token expires after 24 hours.

    

  
  :type maxResults: integer
  :param maxResults: 

    Limits the number of returned log groups to the specified number.

    

  
  
  :rtype: dict
  :returns: 
    
    **Response Syntax**

    
    ::

      {
          'logGroupIdentifiers': [
              'string',
          ],
          'nextToken': 'string'
      }
      
    **Response Structure**

    

    - *(dict) --* 
      

      - **logGroupIdentifiers** *(list) --* 

        An array of the names and ARNs of the log groups that were processed in the query.

        
        

        - *(string) --* 
    
      

      - **nextToken** *(string) --* 

        The token for the next set of items to return. The token expires after 24 hours.

        
  
  **Exceptions**
  
  *   :py:class:`CloudWatchLogs.Client.exceptions.InvalidParameterException`

  
  *   :py:class:`CloudWatchLogs.Client.exceptions.AccessDeniedException`

  
  *   :py:class:`CloudWatchLogs.Client.exceptions.ResourceNotFoundException`

  
  *   :py:class:`CloudWatchLogs.Client.exceptions.ServiceUnavailableException`

  