> ## Documentation Index
> Fetch the complete documentation index at: https://docs.cloud.cdata.com/llms.txt
> Use this file to discover all available pages before exploring further.

# List Query Log

> Retrieves a list of query logs for an account.

The response contains at most 500 queries. If `incomplete` is `true`, more queries may match your request. To retrieve them, narrow the time range, or send the request again with `endTime` set to the `timestamp` of the oldest query returned. If `incomplete` is `true` and no queries are returned, narrow the time range instead. A row that shares the oldest `timestamp` and was not in the response is skipped when you use `endTime`. To retrieve it, set `startTime` to that `timestamp` and `endTime` to one millisecond later.

Filters on user names and connection names match exact letter case when the query log is read from the central log store.

When the query log is read from the central log store, `logFileKey` and `timeToFirstRow` are always null. A null `logFileKey` does not mean the query has no logs. Use the Get Query Log operation to download them.




## OpenAPI

````yaml en/API/REST-API.yaml POST /log/query/list
openapi: 3.1.0
info:
  title: CData Connect AI REST API
  version: v1
servers:
  - url: https://cloud.cdata.com/api
    description: Production base URL
security:
  - Basic: []
paths:
  /log/query/list:
    post:
      tags:
        - Log
      summary: List Query Log
      description: >
        Retrieves a list of query logs for an account.


        The response contains at most 500 queries. If `incomplete` is `true`,
        more queries may match your request. To retrieve them, narrow the time
        range, or send the request again with `endTime` set to the `timestamp`
        of the oldest query returned. If `incomplete` is `true` and no queries
        are returned, narrow the time range instead. A row that shares the
        oldest `timestamp` and was not in the response is skipped when you use
        `endTime`. To retrieve it, set `startTime` to that `timestamp` and
        `endTime` to one millisecond later.


        Filters on user names and connection names match exact letter case when
        the query log is read from the central log store.


        When the query log is read from the central log store, `logFileKey` and
        `timeToFirstRow` are always null. A null `logFileKey` does not mean the
        query has no logs. Use the Get Query Log operation to download them.
      operationId: listQueryLog
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/QuerySearchCriteria'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/QuerySearchResult'
              example:
                queries:
                  - credential: prat8897@gmail.com
                    duration: 308
                    drivers: PostgreSQL
                    errorCode: QUERY_FAILED
                    errorMessage: "The stored procedure execution failed with the following error:\r\n[500] Could not execute the specified command: Unknown stored function/procedure transferdata\r\n<Query ID: e1af1260-4045-45e4-882b-96fe2575e37b>"
                    logFileKey: >-
                      x41GvdkvWlJsaEdQrzI2+t7M+TSbimW8iJIfQPv9mK1PqurO1/pzPW3D2ObewKfK6w51T7ui8yecrEYV3JpW9WmsAU+yVv4Vke1D2lB8EeKsv3ab6w2ZXrNZxPBAgaKAZLoRf8zbuHGWDGSQQ9gDJg==
                    logVerbosity: 1
                    query: PostgreSQL1.public.transferdata
                    queryId: e1af1260-4045-45e4-882b-96fe2575e37b
                    queryType: 203
                    rowsAffected: -1
                    rowsInput: 1
                    rowsReturned: 0
                    timestamp: '2024-03-19T18:55:34.837Z'
                    userAgent: PostmanRuntime/7.37.0
components:
  schemas:
    QuerySearchCriteria:
      type: object
      properties:
        endTime:
          type: string
          format: date-time
          nullable: true
          description: The end time of the query.
        queryType:
          type: array
          items:
            $ref: '#/components/schemas/QueryType'
          nullable: true
          default: 2
          description: The type of query.
        startTime:
          type: string
          format: date-time
          nullable: true
          description: The start time of the query.
      additionalProperties: false
    QuerySearchResult:
      type: object
      properties:
        queries:
          type: array
          items:
            $ref: '#/components/schemas/QueryRecord'
          nullable: true
        incomplete:
          type: boolean
          description: >-
            If true, more queries may match the request than the response
            contains.
      additionalProperties: false
    QueryType:
      enum:
        - 0
        - 1
        - 2
        - 3
        - 4
        - 5
        - 6
        - 7
        - 8
        - 9
        - 10
        - 11
        - 20
        - 100
        - 101
        - 102
        - 103
        - 104
        - 105
        - 106
        - 107
        - 108
        - 109
        - 200
        - 201
        - 202
        - 203
        - 204
        - 205
        - 210
        - 211
        - 212
        - 220
        - 230
        - 231
        - 232
      type: integer
      format: int32
      description: |
        | Value | Name |
        |-------|------|
        | 0 | Drivers |
        | 1 | DriverInfo |
        | 2 | TestConnection |
        | 3 | GetOAuthAuthorizationUrl |
        | 4 | GetOAuthAccessToken |
        | 5 | CustomReportInfo |
        | 6 | GenerateCustomReport |
        | 7 | GetAPIRootPaths |
        | 8 | GetAPIColumns |
        | 9 | GetAPIRows |
        | 10 | GetTimeCheckColumns |
        | 11 | GetDynamicPropValues |
        | 20 | DisconnectOAuthAccessToken |
        | 100 | Catalogs |
        | 101 | Schemas |
        | 102 | Tables |
        | 103 | Columns |
        | 104 | PrimaryKeys |
        | 105 | ImportedKeys |
        | 106 | ExportedKeys |
        | 107 | Procedures |
        | 108 | ProcedureParameters |
        | 109 | Indexes |
        | 200 | Query |
        | 201 | QuerySchemaOnly |
        | 202 | Batch |
        | 203 | Exec |
        | 204 | Caching |
        | 205 | ScheduledQuery |
        | 210 | ODataServiceDocument |
        | 211 | ODataMetadata |
        | 212 | ODataQuery |
        | 220 | OpenAPIDocument |
        | 230 | CreateDerivedView |
        | 231 | AlterDerivedView |
        | 232 | DropDerivedView |
    QueryRecord:
      type: object
      properties:
        credential:
          type: string
          nullable: true
          description: The user's credential used to execute the query.
        duration:
          type: integer
          format: int64
          description: The duration of the query in milliseconds.
        drivers:
          type: string
          nullable: true
          description: The driver used to execute the query.
        errorCode:
          type: string
          nullable: true
          description: In the case of an error, the error code.
        errorMessage:
          type: string
          nullable: true
          description: The error message of the query, if applicable.
        logVerbosity:
          type: integer
          format: int32
          nullable: true
          description: The verbosity level of the query log.
        query:
          type: string
          nullable: true
          description: The contents of the query.
        queryId:
          type: string
          format: uuid
          description: The unique Id of the query.
        queryType:
          $ref: '#/components/schemas/QueryType'
          description: The type of query.
        rowsAffected:
          type: integer
          format: int64
          description: The number of rows affected by the query.
        rowsReturned:
          type: integer
          format: int64
          description: The number of rows returned by the query as a result set.
        timestamp:
          type: string
          format: date-time
          description: The timestamp of the query.
        userAgent:
          type: string
          nullable: true
          description: The user agent used to execute the query.
      additionalProperties: false
  securitySchemes:
    Basic:
      type: http
      scheme: basic
      description: >-
        Basic Authentication with username and password. Use your PAT as the
        password. You can get your PAT from Connect AI by selecting **Settings**
        > **Access Tokens**.

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.