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

****************
describe_queries
****************



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

  

  Returns a list of CloudWatch Logs Insights queries that are scheduled, running, or have been run recently in this account. You can request all queries or limit it to queries of a specific log group or queries with a certain status.

   

  This operation includes both interactive queries started directly by users and automated queries executed by scheduled query configurations. Scheduled query executions appear in the results alongside manually initiated queries, providing visibility into all query activity in your account.

  

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


  **Request Syntax**
  ::

    response = client.describe_queries(
        logGroupName='string',
        status='Scheduled'|'Running'|'Complete'|'Failed'|'Cancelled'|'Timeout'|'Unknown',
        maxResults=123,
        nextToken='string',
        queryLanguage='CWLI'|'SQL'|'PPL'
    )
    
  :type logGroupName: string
  :param logGroupName: 

    Limits the returned queries to only those for the specified log group.

    

  
  :type status: string
  :param status: 

    Limits the returned queries to only those that have the specified status. Valid values are ``Cancelled``, ``Complete``, ``Failed``, ``Running``, and ``Scheduled``.

    

  
  :type maxResults: integer
  :param maxResults: 

    Limits the number of returned queries to the specified number.

    

  
  :type nextToken: string
  :param nextToken: 

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

    

  
  :type queryLanguage: string
  :param queryLanguage: 

    Limits the returned queries to only the queries that use the specified query language.

    

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

    
    ::

      {
          'queries': [
              {
                  'queryLanguage': 'CWLI'|'SQL'|'PPL',
                  'queryId': 'string',
                  'queryString': 'string',
                  'status': 'Scheduled'|'Running'|'Complete'|'Failed'|'Cancelled'|'Timeout'|'Unknown',
                  'createTime': 123,
                  'logGroupName': 'string'
              },
          ],
          'nextToken': 'string'
      }
      
    **Response Structure**

    

    - *(dict) --* 
      

      - **queries** *(list) --* 

        The list of queries that match the request.

        
        

        - *(dict) --* 

          Information about one CloudWatch Logs Insights query that matches the request in a ``DescribeQueries`` operation.

          
          

          - **queryLanguage** *(string) --* 

            The query language used for this query. For more information about the query languages that CloudWatch Logs supports, see `Supported query languages <https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/CWL_AnalyzeLogData_Languages.html>`__.

            
          

          - **queryId** *(string) --* 

            The unique ID number of this query.

            
          

          - **queryString** *(string) --* 

            The query string used in this query.

            
          

          - **status** *(string) --* 

            The status of this query. Possible values are ``Cancelled``, ``Complete``, ``Failed``, ``Running``, ``Scheduled``, and ``Unknown``.

            
          

          - **createTime** *(integer) --* 

            The date and time that this query was created.

            
          

          - **logGroupName** *(string) --* 

            The name of the log group scanned by this query.

            
      
    
      

      - **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.ResourceNotFoundException`

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

  