Skip to content

create_lookup_table

create_lookup_table(
    lookup_table_name: LookupTableName,
    *,
    config_overrides: Optional[CloudWatchLogsClientConfig] = None,
    description: Optional[LookupTableDescription] = None,
    table_body: Optional[TableBody] = None,
    query_id: Optional[QueryId] = None,
    kms_key_id: Optional[KmsKeyId] = None,
    tags: Optional[Tags] = None,
) -> CreateLookupTableResponse

Creates a lookup table by uploading CSV data or from CloudWatch Logs query results. You can use lookup tables to enrich log data in CloudWatch Logs queries with reference data such as user details, application names, or error descriptions.

The table name must be unique within your account and Region. You must specify either tableBody or queryId, but not both. If you use tableBody, the CSV content must include a header row with column names, use UTF-8 encoding, and not exceed 10 MB.

Parameters:

  • lookup_table_name (LookupTableName) –

    The name of the lookup table. The name must be unique within your account and Region. The name can contain only alphanumeric characters and underscores, and can be up to 256 characters long.

  • description (Optional[LookupTableDescription], default: None ) –

    A description of the lookup table. The description can be up to 1024 characters long.

  • table_body (Optional[TableBody], default: None ) –

    The CSV content of the lookup table. The first row must be a header row with column names. The content must use UTF-8 encoding and not exceed 10 MB.

    You must specify either tableBody or queryId, but not both.

  • query_id (Optional[QueryId], default: None ) –

    The ID of a completed or cancelled CloudWatch Logs query whose results populate the lookup table. A cancelled query populates the table with the partial results that were available when the query was stopped.

    You must specify either tableBody or queryId, but not both.

  • kms_key_id (Optional[KmsKeyId], default: None ) –

    The ARN of the KMS key to use to encrypt the lookup table data. If you don't specify a key, the data is encrypted with an Amazon Web Services-owned key.

  • tags (Optional[Tags], default: None ) –

    A list of key-value pairs to associate with the lookup table. You can associate as many as 50 tags with a lookup table. Tags can help you organize and categorize your resources.

Raises:

Source code in docs_src/capo_cloudwatch_logs/_services/cloud_watch_logs.py
def create_lookup_table(
    self,
    lookup_table_name: "capo_cloudwatch_logs.types.lookup_table_name.LookupTableName",
    *,
    config_overrides: Optional[CloudWatchLogsClientConfig] = None,
    description: Optional[
        "capo_cloudwatch_logs.types.lookup_table_description.LookupTableDescription"
    ] = None,
    table_body: Optional["capo_cloudwatch_logs.types.table_body.TableBody"] = None,
    query_id: Optional["capo_cloudwatch_logs.types.query_id.QueryId"] = None,
    kms_key_id: Optional["capo_cloudwatch_logs.types.kms_key_id.KmsKeyId"] = None,
    tags: Optional["capo_cloudwatch_logs.types.tags.Tags"] = None,
) -> "capo_cloudwatch_logs.types.create_lookup_table_response.CreateLookupTableResponse":
    """<p>Creates a lookup table by uploading CSV data or from CloudWatch Logs query results. You can use lookup tables to enrich log data in CloudWatch Logs queries with reference data such as user details, application names, or error descriptions.</p> <p>The table name must be unique within your account and Region. You must specify either <code>tableBody</code> or <code>queryId</code>, but not both. If you use <code>tableBody</code>, the CSV content must include a header row with column names, use UTF-8 encoding, and not exceed 10 MB.</p>

    Args:
        lookup_table_name: <p>The name of the lookup table. The name must be unique within your account and Region. The name can contain only alphanumeric characters and underscores, and can be up to 256 characters long.</p>
        description: <p>A description of the lookup table. The description can be up to 1024 characters long.</p>
        table_body: <p>The CSV content of the lookup table. The first row must be a header row with column names. The content must use UTF-8 encoding and not exceed 10 MB.</p> <p>You must specify either <code>tableBody</code> or <code>queryId</code>, but not both.</p>
        query_id: <p>The ID of a completed or cancelled CloudWatch Logs query whose results populate the lookup table. A cancelled query populates the table with the partial results that were available when the query was stopped.</p> <p>You must specify either <code>tableBody</code> or <code>queryId</code>, but not both.</p>
        kms_key_id: <p>The ARN of the KMS key to use to encrypt the lookup table data. If you don't specify a key, the data is encrypted with an Amazon Web Services-owned key.</p>
        tags: <p>A list of key-value pairs to associate with the lookup table. You can associate as many as 50 tags with a lookup table. Tags can help you organize and categorize your resources.</p>

    Raises:
        capo_cloudwatch_logs.errors.access_denied_exception.AccessDeniedException: <p>You don't have sufficient permissions to perform this action.</p>
        capo_cloudwatch_logs.errors.invalid_parameter_exception.InvalidParameterException: <p>A parameter is specified incorrectly.</p>
        capo_cloudwatch_logs.errors.limit_exceeded_exception.LimitExceededException: <p>You have reached the maximum number of resources that can be created.</p>
        capo_cloudwatch_logs.errors.resource_already_exists_exception.ResourceAlreadyExistsException: <p>The specified resource already exists.</p>
        capo_cloudwatch_logs.errors.service_unavailable_exception.ServiceUnavailableException: <p>The service cannot complete the request.</p>
        capo_cloudwatch_logs.errors.validation_exception.ValidationException: <p>One of the parameters for the request is not valid.</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_lookup_table_request.CreateLookupTableRequest]",
    ) -> OperationResponse[
        "capo_cloudwatch_logs.types.create_lookup_table_response.CreateLookupTableResponse"
    ]:
        import capo_cloudwatch_logs._operations.logs_20140328.create_lookup_table

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

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("CreateLookupTable")
    )
    input_: capo_cloudwatch_logs.types.create_lookup_table_request.CreateLookupTableRequest = {
        "lookup_table_name": lookup_table_name
    }
    if description is not None:
        input_["description"] = description
    if table_body is not None:
        input_["table_body"] = table_body
    if query_id is not None:
        input_["query_id"] = query_id
    if kms_key_id is not None:
        input_["kms_key_id"] = kms_key_id
    if tags is not None:
        input_["tags"] = tags

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