Skip to content

create_log_stream

create_log_stream(
    log_group_name: LogGroupName,
    log_stream_name: LogStreamName,
    *,
    config_overrides: Optional[CloudWatchLogsClientConfig] = None,
) -> None

Creates a log stream for the specified log group. A log stream is a sequence of log events that originate from a single source, such as an application instance or a resource that is being monitored.

There is no limit on the number of log streams that you can create for a log group. There is a limit of 50 TPS on CreateLogStream operations, after which transactions are throttled.

You must use the following guidelines when naming a log stream:

  • Log stream names must be unique within the log group.

  • Log stream names can be between 1 and 512 characters long.

  • Don't use ':' (colon) or '*' (asterisk) characters.

Parameters:

  • log_group_name (LogGroupName) –

    The name of the log group.

  • log_stream_name (LogStreamName) –

    The name of the log stream.

Raises:

Source code in docs_src/capo_cloudwatch_logs/_services/cloud_watch_logs.py
def create_log_stream(
    self,
    log_group_name: "capo_cloudwatch_logs.types.log_group_name.LogGroupName",
    log_stream_name: "capo_cloudwatch_logs.types.log_stream_name.LogStreamName",
    *,
    config_overrides: Optional[CloudWatchLogsClientConfig] = None,
) -> None:
    """<p>Creates a log stream for the specified log group. A log stream is a sequence of log events that originate from a single source, such as an application instance or a resource that is being monitored.</p> <p>There is no limit on the number of log streams that you can create for a log group. There is a limit of 50 TPS on <code>CreateLogStream</code> operations, after which transactions are throttled.</p> <p>You must use the following guidelines when naming a log stream:</p> <ul> <li> <p>Log stream names must be unique within the log group.</p> </li> <li> <p>Log stream names can be between 1 and 512 characters long.</p> </li> <li> <p>Don't use ':' (colon) or '*' (asterisk) characters.</p> </li> </ul>

    Args:
        log_group_name: <p>The name of the log group.</p>
        log_stream_name: <p>The name of the log stream.</p>

    Raises:
        capo_cloudwatch_logs.errors.invalid_parameter_exception.InvalidParameterException: <p>A parameter is specified incorrectly.</p>
        capo_cloudwatch_logs.errors.resource_already_exists_exception.ResourceAlreadyExistsException: <p>The specified resource already exists.</p>
        capo_cloudwatch_logs.errors.resource_not_found_exception.ResourceNotFoundException: <p>The specified resource does not exist.</p>
        capo_cloudwatch_logs.errors.service_unavailable_exception.ServiceUnavailableException: <p>The service cannot complete the request.</p>
        capo_cloudwatch_logs.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    def _handler(
        req: "OperationRequest[capo_cloudwatch_logs.types.create_log_stream_request.CreateLogStreamRequest]",
    ) -> OperationResponse[None]:
        import capo_cloudwatch_logs._operations.logs_20140328.create_log_stream

        output, http_response = (
            capo_cloudwatch_logs._operations.logs_20140328.create_log_stream.create_log_stream(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("CreateLogStream")
    )
    input_: capo_cloudwatch_logs.types.create_log_stream_request.CreateLogStreamRequest = {
        "log_group_name": log_group_name,
        "log_stream_name": log_stream_name,
    }

    response = execute_pipeline(
        OperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    response.response.close()
    return response.output