Skip to content

get_relational_database_log_events async

get_relational_database_log_events(
    relational_database_name: ResourceName,
    log_stream_name: string,
    *,
    config_overrides: Optional[AsyncLightsailClientConfig] = None,
    start_time: Optional[IsoDate] = None,
    end_time: Optional[IsoDate] = None,
    start_from_head: Optional[boolean] = None,
    page_token: Optional[string] = None,
) -> GetRelationalDatabaseLogEventsResult

Returns a list of log events for a database in Amazon Lightsail.

Parameters:

  • relational_database_name (ResourceName) –

    The name of your database for which to get log events.

  • log_stream_name (string) –

    The name of the log stream.

    Use the get relational database log streams operation to get a list of available log streams.

  • start_time (Optional[IsoDate], default: None ) –

    The start of the time interval from which to get log events.

    Constraints:

    • Specified in Coordinated Universal Time (UTC).

    • Specified in the Unix time format.

      For example, if you wish to use a start time of October 1, 2018, at 8 PM UTC, then you input 1538424000 as the start time.

  • end_time (Optional[IsoDate], default: None ) –

    The end of the time interval from which to get log events.

    Constraints:

    • Specified in Coordinated Universal Time (UTC).

    • Specified in the Unix time format.

      For example, if you wish to use an end time of October 1, 2018, at 8 PM UTC, then you input 1538424000 as the end time.

  • start_from_head (Optional[boolean], default: None ) –

    Parameter to specify if the log should start from head or tail. If true is specified, the log event starts from the head of the log. If false is specified, the log event starts from the tail of the log.

    For PostgreSQL, the default value of false is the only option available.

  • page_token (Optional[string], default: None ) –

    The token to advance to the next or previous page of results from your request.

    To get a page token, perform an initial GetRelationalDatabaseLogEvents request. If your results are paginated, the response will return a next forward token and/or next backward token that you can specify as the page token in a subsequent request.

Raises:

  • AccessDeniedException –

    Lightsail throws this exception when the user cannot be authenticated or uses invalid credentials to access a resource.

  • AccountSetupInProgressException –

    Lightsail throws this exception when an account is still in the setup in progress state.

  • InvalidInputException –

    Lightsail throws this exception when user input does not conform to the validation rules of an input field.

    Domain and distribution APIs are only available in the N. Virginia (us-east-1) Amazon Web Services Region. Please set your Amazon Web Services Region configuration to us-east-1 to create, view, or edit these resources.

  • NotFoundException –

    Lightsail throws this exception when it cannot find a resource.

  • OperationFailureException –

    Lightsail throws this exception when an operation fails to execute.

  • RegionSetupInProgressException –

    Lightsail throws this exception when an operation is performed on resources in an opt-in Region that is currently being set up.

  • ServiceException –

    A general service exception.

  • UnauthenticatedException –

    Lightsail throws this exception when the user has not been authenticated.

  • UnknownServiceError –

    The service returned an error code this client does not model.

Source code in docs_src/capo_lightsail/_services/async_lightsail.py
async def get_relational_database_log_events(
    self,
    relational_database_name: "capo_lightsail.types.resource_name.ResourceName",
    log_stream_name: "capo_lightsail.types.string.string",
    *,
    config_overrides: Optional[AsyncLightsailClientConfig] = None,
    start_time: Optional["capo_lightsail.types.iso_date.IsoDate"] = None,
    end_time: Optional["capo_lightsail.types.iso_date.IsoDate"] = None,
    start_from_head: Optional["capo_lightsail.types.boolean.boolean"] = None,
    page_token: Optional["capo_lightsail.types.string.string"] = None,
) -> "capo_lightsail.types.get_relational_database_log_events_result.GetRelationalDatabaseLogEventsResult":
    """<p>Returns a list of log events for a database in Amazon Lightsail.</p>

    Args:
        relational_database_name: <p>The name of your database for which to get log events.</p>
        log_stream_name: <p>The name of the log stream.</p> <p>Use the <code>get relational database log streams</code> operation to get a list of available log streams.</p>
        start_time: <p>The start of the time interval from which to get log events.</p> <p>Constraints:</p> <ul> <li> <p>Specified in Coordinated Universal Time (UTC).</p> </li> <li> <p>Specified in the Unix time format.</p> <p>For example, if you wish to use a start time of October 1, 2018, at 8 PM UTC, then you input <code>1538424000</code> as the start time.</p> </li> </ul>
        end_time: <p>The end of the time interval from which to get log events.</p> <p>Constraints:</p> <ul> <li> <p>Specified in Coordinated Universal Time (UTC).</p> </li> <li> <p>Specified in the Unix time format.</p> <p>For example, if you wish to use an end time of October 1, 2018, at 8 PM UTC, then you input <code>1538424000</code> as the end time.</p> </li> </ul>
        start_from_head: <p>Parameter to specify if the log should start from head or tail. If <code>true</code> is specified, the log event starts from the head of the log. If <code>false</code> is specified, the log event starts from the tail of the log.</p> <note> <p>For PostgreSQL, the default value of <code>false</code> is the only option available.</p> </note>
        page_token: <p>The token to advance to the next or previous page of results from your request.</p> <p>To get a page token, perform an initial <code>GetRelationalDatabaseLogEvents</code> request. If your results are paginated, the response will return a next forward token and/or next backward token that you can specify as the page token in a subsequent request.</p>

    Raises:
        capo_lightsail.errors.access_denied_exception.AccessDeniedException: <p>Lightsail throws this exception when the user cannot be authenticated or uses invalid credentials to access a resource.</p>
        capo_lightsail.errors.account_setup_in_progress_exception.AccountSetupInProgressException: <p>Lightsail throws this exception when an account is still in the setup in progress state.</p>
        capo_lightsail.errors.invalid_input_exception.InvalidInputException: <p>Lightsail throws this exception when user input does not conform to the validation rules of an input field.</p> <note> <p>Domain and distribution APIs are only available in the N. Virginia (<code>us-east-1</code>) Amazon Web Services Region. Please set your Amazon Web Services Region configuration to <code>us-east-1</code> to create, view, or edit these resources.</p> </note>
        capo_lightsail.errors.not_found_exception.NotFoundException: <p>Lightsail throws this exception when it cannot find a resource.</p>
        capo_lightsail.errors.operation_failure_exception.OperationFailureException: <p>Lightsail throws this exception when an operation fails to execute.</p>
        capo_lightsail.errors.region_setup_in_progress_exception.RegionSetupInProgressException: <p>Lightsail throws this exception when an operation is performed on resources in an opt-in Region that is currently being set up.</p>
        capo_lightsail.errors.service_exception.ServiceException: <p>A general service exception.</p>
        capo_lightsail.errors.unauthenticated_exception.UnauthenticatedException: <p>Lightsail throws this exception when the user has not been authenticated.</p>
        capo_lightsail.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_lightsail.types.get_relational_database_log_events_request.GetRelationalDatabaseLogEventsRequest]",
    ) -> AsyncOperationResponse[
        "capo_lightsail.types.get_relational_database_log_events_result.GetRelationalDatabaseLogEventsResult"
    ]:
        import capo_lightsail._operations.lightsail_20161128.get_relational_database_log_events

        (
            output,
            http_response,
        ) = await capo_lightsail._operations.lightsail_20161128.get_relational_database_log_events.async_get_relational_database_log_events(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("GetRelationalDatabaseLogEvents")
    )
    input_: capo_lightsail.types.get_relational_database_log_events_request.GetRelationalDatabaseLogEventsRequest = {
        "relational_database_name": relational_database_name,
        "log_stream_name": log_stream_name,
    }
    if start_time is not None:
        input_["start_time"] = start_time
    if end_time is not None:
        input_["end_time"] = end_time
    if start_from_head is not None:
        input_["start_from_head"] = start_from_head
    if page_token is not None:
        input_["page_token"] = page_token

    response = await aexecute_pipeline(
        AsyncOperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    await response.response.aclose()
    return response.output