Getting Information About Your API Logs

You can get information about your API logs with Cockpit v2 or the ReadApiLogs method. For more information, see About OMS.

Getting Information About Your API Logs Using Cockpit v2

  1. In the top right corner, click the IconProfil icon.
    A drop-down menu appears.

  2. Click IconAPILogs API Logs.
    The list of your API logs appears.

    Past logs are accessible for up to 32 days.

Getting Information About Your API Logs Using OSC CLI

The ReadApiLogs command lists the logs of the API calls you have performed with this account.

Past logs are accessible for up to 32 days.
By default, the retrieved interval is 48 hours. If neither of the QueryDateBefore nor QueryDateAfter parameters are specified, logs from the past 48 hours are retrieved. If you only specify one of two, logs are retrieved from a 2-day interval based on the date you provided. To retrieve logs beyond a 2-day interval, specify both parameters.

For more information, see About OMS.

Request sample
$ osc-cli api ReadApiLogs --profile "default" \
    --Filters '{
        "QueryIpAddresses": ["192.0.2.0", "198.51.100.0"],
        "QueryDateAfter": "2017-05-10",
        "QueryDateBefore": "2017-05-10"
      }'

This command contains the following attributes that you need to specify:

  • DryRun: (optional) If true, checks whether you have the required permissions to perform the action.

  • Filters: (optional) One or more filters.

    • QueryAccessKeys: (optional) The access keys used for the logged calls.

    • QueryApiNames: (optional) The names of the APIs of the logged calls (always oapi for the OUTSCALE API).

    • QueryCallNames: (optional) The names of the logged calls.

    • QueryDateAfter: (optional) The date and time, or the date, after which you want to retrieve logged calls, in ISO 8601 format (for example, 2020-06-14T00:00:00.000Z or 2020-06-14). By default, this date is set to 48 hours before the QueryDateBefore parameter value.

    • QueryDateBefore: (optional) The date and time, or the date, before which you want to retrieve logged calls, in ISO 8601 format (for example, 2020-06-30T00:00:00.000Z or 2020-06-14). By default, this date is set to now, or 48 hours after the QueryDateAfter parameter value.

    • QueryIpAddresses: (optional) The IPs used for the logged calls.

    • QueryUserAgents: (optional) The user agents of the HTTP requests of the logged calls.

    • RequestIds: (optional) The request IDs provided in the responses of the logged calls.

    • ResponseStatusCodes: (optional) The HTTP status codes of the logged calls.

  • NextPageToken: (optional) The token to request the next page of results. Each token refers to a specific page.

  • ResultsPerPage: (optional) The maximum number of logs returned in a single response (between 1 and 1000, both included). By default, 100.

  • With: (optional) The information to display in each returned log.

    • AccountId: (optional) By default or if set to true, the account ID is displayed.

    • CallDuration: (optional) By default or if set to true, the duration of the call is displayed.

    • QueryAccessKey: (optional) By default or if set to true, the access key is displayed.

    • QueryApiName: (optional) By default or if set to true, the name of the API is displayed.

    • QueryApiVersion: (optional) By default or if set to true, the version of the API is displayed.

    • QueryCallName: (optional) By default or if set to true, the name of the call is displayed.

    • QueryDate: (optional) By default or if set to true, the date of the call is displayed.

    • QueryHeaderRaw: (optional) By default or if set to true, the raw header of the HTTP request is displayed.

    • QueryHeaderSize: (optional) By default or if set to true, the size of the raw header of the HTTP request is displayed.

    • QueryIpAddress: (optional) By default or if set to true, the IP is displayed.

    • QueryPayloadRaw: (optional) By default or if set to true, the raw payload of the HTTP request is displayed.

    • QueryPayloadSize: (optional) By default or if set to true, the size of the raw payload of the HTTP request is displayed.

    • QueryUserAgent: (optional) By default or if set to true, the user agent of the HTTP request is displayed.

    • RequestId: (optional) By default or if set to true, the request ID is displayed.

    • ResponseSize: (optional) By default or if set to true, the size of the response is displayed.

    • ResponseStatusCode: (optional) By default or if set to true, the HTTP status code of the response is displayed.

The ReadApiLogs command returns the following elements:

  • Logs: Information about one or more logs.

    • AccountId: The account ID of the logged call.

    • CallDuration: The duration of the logged call, in microseconds.

    • QueryAccessKey: The access key used for the logged call.

    • QueryApiName: The name of the API used by the logged call (always oapi for the OUTSCALE API).

    • QueryApiVersion: The version of the API used by the logged call.

    • QueryCallName: The name of the logged call.

    • QueryDate: The date and time (UTC) of the logged call.

    • QueryHeaderRaw: The raw header of the HTTP request of the logged call.

    • QueryHeaderSize: The size of the raw header of the HTTP request of the logged call, in bytes.

    • QueryIpAddress: The IP used for the logged call.

    • QueryPayloadRaw: The raw payload of the HTTP request of the logged call.

    • QueryPayloadSize: The size of the raw payload of the HTTP request of the logged call, in bytes.

    • QueryUserAgent: The user agent of the HTTP request of the logged call.

    • RequestId: The request ID provided in the response of the logged call.

    • ResponseSize: The size of the response of the logged call, in bytes.

    • ResponseStatusCode: The HTTP status code of the response of the logged call.

  • NextPageToken: The token to request the next page of results. Each token refers to a specific page.

  • ResponseContext: Information about the context of the response.

    • RequestId: The ID of the request.

Result sample
{
  "ResponseContext": {
    "RequestId": "0475ca1e-d0c5-441d-712a-da55a4175157"
  },
  "Logs": [
    {
      "ResponseStatusCode": 200,
      "ResponseSize": 1887,
      "QueryPayloadRaw": "{}",
      "QueryApiName": "oapi",
      "QueryIpAddress": "192.0.2.0",
      "QueryUserAgent": "oAPI CLI v0.1 - 2018-09-28",
      "CallDuration": 47,
      "RequestId": "0475ca1e-d0c5-441d-712a-da55a4175157",
      "QueryApiVersion": "1.27",
      "AccountId": "123456789012",
      "QueryPayloadSize": 2,
      "QueryCallName": "ReadAccessKeys",
      "QueryAccessKey": "ABCDEFGHIJ0123456789",
      "QueryHeaderSize": 287,
      "QueryDate": "2017-05-10T12:34:56.789Z",
      "QueryHeaderRaw": "Host: api.eu-west-2.outscale.com\\nAccept: */*\\nConnection: close\\nUser-Agent: oAPI CLI v0.1 - 2018-09-28\\nX-Osc-Date: 20170510T000000Z\\nContent-Type: application/json; charset=utf-8\\nAuthorization: *****\\nContent-Length: 2\\nAccept-Encoding: gzip, deflate\\nX-Forwarded-For: 192.0.2.0"
    }
  ]
}

Getting Information About Your API Logs Using oapi-cli

The ReadApiLogs command lists the logs of the API calls you have performed with this account.

Past logs are accessible for up to 32 days.
By default, the retrieved interval is 48 hours. If neither of the QueryDateBefore nor QueryDateAfter parameters are specified, logs from the past 48 hours are retrieved. If you only specify one of two, logs are retrieved from a 2-day interval based on the date you provided. To retrieve logs beyond a 2-day interval, specify both parameters.

For more information, see About OMS.

Request sample
$ oapi-cli --profile "default" ReadApiLogs \
    --Filters '{
        "QueryIpAddresses": ["192.0.2.0", "198.51.100.0"],
        "QueryDateAfter": "2017-05-10",
        "QueryDateBefore": "2017-05-10"
      }'

This command contains the following attributes that you need to specify:

  • DryRun: (optional) If true, checks whether you have the required permissions to perform the action.

  • Filters: (optional) One or more filters.

    • QueryAccessKeys: (optional) The access keys used for the logged calls.

    • QueryApiNames: (optional) The names of the APIs of the logged calls (always oapi for the OUTSCALE API).

    • QueryCallNames: (optional) The names of the logged calls.

    • QueryDateAfter: (optional) The date and time, or the date, after which you want to retrieve logged calls, in ISO 8601 format (for example, 2020-06-14T00:00:00.000Z or 2020-06-14). By default, this date is set to 48 hours before the QueryDateBefore parameter value.

    • QueryDateBefore: (optional) The date and time, or the date, before which you want to retrieve logged calls, in ISO 8601 format (for example, 2020-06-30T00:00:00.000Z or 2020-06-14). By default, this date is set to now, or 48 hours after the QueryDateAfter parameter value.

    • QueryIpAddresses: (optional) The IPs used for the logged calls.

    • QueryUserAgents: (optional) The user agents of the HTTP requests of the logged calls.

    • RequestIds: (optional) The request IDs provided in the responses of the logged calls.

    • ResponseStatusCodes: (optional) The HTTP status codes of the logged calls.

  • NextPageToken: (optional) The token to request the next page of results. Each token refers to a specific page.

  • ResultsPerPage: (optional) The maximum number of logs returned in a single response (between 1 and 1000, both included). By default, 100.

  • With: (optional) The information to display in each returned log.

    • AccountId: (optional) By default or if set to true, the account ID is displayed.

    • CallDuration: (optional) By default or if set to true, the duration of the call is displayed.

    • QueryAccessKey: (optional) By default or if set to true, the access key is displayed.

    • QueryApiName: (optional) By default or if set to true, the name of the API is displayed.

    • QueryApiVersion: (optional) By default or if set to true, the version of the API is displayed.

    • QueryCallName: (optional) By default or if set to true, the name of the call is displayed.

    • QueryDate: (optional) By default or if set to true, the date of the call is displayed.

    • QueryHeaderRaw: (optional) By default or if set to true, the raw header of the HTTP request is displayed.

    • QueryHeaderSize: (optional) By default or if set to true, the size of the raw header of the HTTP request is displayed.

    • QueryIpAddress: (optional) By default or if set to true, the IP is displayed.

    • QueryPayloadRaw: (optional) By default or if set to true, the raw payload of the HTTP request is displayed.

    • QueryPayloadSize: (optional) By default or if set to true, the size of the raw payload of the HTTP request is displayed.

    • QueryUserAgent: (optional) By default or if set to true, the user agent of the HTTP request is displayed.

    • RequestId: (optional) By default or if set to true, the request ID is displayed.

    • ResponseSize: (optional) By default or if set to true, the size of the response is displayed.

    • ResponseStatusCode: (optional) By default or if set to true, the HTTP status code of the response is displayed.

The ReadApiLogs command returns the following elements:

  • Logs: Information about one or more logs.

    • AccountId: The account ID of the logged call.

    • CallDuration: The duration of the logged call, in microseconds.

    • QueryAccessKey: The access key used for the logged call.

    • QueryApiName: The name of the API used by the logged call (always oapi for the OUTSCALE API).

    • QueryApiVersion: The version of the API used by the logged call.

    • QueryCallName: The name of the logged call.

    • QueryDate: The date and time (UTC) of the logged call.

    • QueryHeaderRaw: The raw header of the HTTP request of the logged call.

    • QueryHeaderSize: The size of the raw header of the HTTP request of the logged call, in bytes.

    • QueryIpAddress: The IP used for the logged call.

    • QueryPayloadRaw: The raw payload of the HTTP request of the logged call.

    • QueryPayloadSize: The size of the raw payload of the HTTP request of the logged call, in bytes.

    • QueryUserAgent: The user agent of the HTTP request of the logged call.

    • RequestId: The request ID provided in the response of the logged call.

    • ResponseSize: The size of the response of the logged call, in bytes.

    • ResponseStatusCode: The HTTP status code of the response of the logged call.

  • NextPageToken: The token to request the next page of results. Each token refers to a specific page.

  • ResponseContext: Information about the context of the response.

    • RequestId: The ID of the request.

Result sample
{
  "ResponseContext": {
    "RequestId": "0475ca1e-d0c5-441d-712a-da55a4175157"
  },
  "Logs": [
    {
      "ResponseStatusCode": 200,
      "ResponseSize": 1887,
      "QueryPayloadRaw": "{}",
      "QueryApiName": "oapi",
      "QueryIpAddress": "192.0.2.0",
      "QueryUserAgent": "oAPI CLI v0.1 - 2018-09-28",
      "CallDuration": 47,
      "RequestId": "0475ca1e-d0c5-441d-712a-da55a4175157",
      "QueryApiVersion": "1.27",
      "AccountId": "123456789012",
      "QueryPayloadSize": 2,
      "QueryCallName": "ReadAccessKeys",
      "QueryAccessKey": "ABCDEFGHIJ0123456789",
      "QueryHeaderSize": 287,
      "QueryDate": "2017-05-10T12:34:56.789Z",
      "QueryHeaderRaw": "Host: api.eu-west-2.outscale.com\\nAccept: */*\\nConnection: close\\nUser-Agent: oAPI CLI v0.1 - 2018-09-28\\nX-Osc-Date: 20170510T000000Z\\nContent-Type: application/json; charset=utf-8\\nAuthorization: *****\\nContent-Length: 2\\nAccept-Encoding: gzip, deflate\\nX-Forwarded-For: 192.0.2.0"
    }
  ]
}

Related Pages

Corresponding API Method