Create an export task

Updated at:
Copy as MD

This topic describes how to create an export task to send log data to TSDB.

Background

Alibaba Cloud Log Service is a comprehensive service that collects and processes logs from various cloud products. You can export log records from Log Service to TSDB, where they are mapped to data points for time-series storage.

Prerequisites

  • You must have active subscriptions for both Alibaba Cloud Log Service and TSDB.

  • Log Service and TSDB must be in the same region. Cross-region data delivery is not supported.

Procedure

You can create a TSDB export task in the Log Service console. During this process, you can configure task details such as the destination TSDB instance and metric, and the export start time.

  1. Log on to the Log Service console and select the target Project and Logstore.

  2. For the selected Logstore, navigate to Data Processing > Export > TSDB. The Export menu includes options such as MaxCompute, OSS, EMR, AnalyticDB, and TSDB.

  3. Click the + button to open the export task configuration page.

  4. If you have not configured data processing for the Logstore, Log Service prompts you to do so before creating the export task. If your log records are already well-structured, you can deliver them directly to TSDB without processing.

  5. Configure the parameters for the task. All parameters marked with an asterisk (*) are required. TSDB Instance is a drop-down list. For Field mapping and Tag mapping, you can click the Add button to create multiple mapping rules. For field mapping, you also need to select a data type, such as string. When you finish the configuration, click Submit to create the export task. The following table describes the parameters.

    Parameter

    Description

    Task Name

    A unique name for the task.

    Task Description

    A description of the task.

    TSDB Instance

    Select the destination TSDB instance from the list of instances available in the current region.

    Metric Name

    Specify the name of the destination TSDB metric.

    AccessKey ID

    The AccessKey ID for your Alibaba Cloud account.

    AccessKey Secret

    The AccessKey Secret for your Alibaba Cloud account.

    Timestamp mapping

    Maps the timestamp from the log record to the TSDB timestamp. By default, the log creation time ("${logTag:__time__}") is used. This field supports expression substitution.

    Field mapping

    Map log fields to TSDB fields. For each mapping, specify the source log field and the destination TSDB field. If you configure a single field mapping, data is exported using the TSDB single-value model, and the destination TSDB field name must be value. If you configure multiple field mappings, data is exported using the TSDB multi-value model.

    Tag mapping

    Define TSDB tags for the exported data points. For each tag, specify a tag name and its corresponding value. Both the name and value support expression substitution.

    Start Time

    The earliest time from which to export data. Data created before this time will not be exported.

    Note

    If the specified metric does not exist, it is created automatically. When exporting logs from Log Service to TSDB, the timestamp mapping sets the timestamp for each data point. By default, the value is the timestamp of the Log Service log record (${logTag:__time__}). Because the default timestamp has a one-second precision, you may need to map the data point timestamp to a more precise field in your log data to ensure uniqueness. For timestamp mapping, you can use expressions such as ${logTag:xx} and ${logColumn:xx} for value substitution. The field referenced in the expression must be convertible to a numeric value in epoch seconds or milliseconds. If substitution fails, the task uses the default log record time (${logTag:__time__}) as a fallback.

    Expression reference

    During task configuration, the timestamp mapping and tag mapping settings support expressions to dynamically reference contextual information. The expression syntax is as follows:

    Note

    ${context:variable}

    • The logColumn prefix references the value of a specified column in the original log record.

    • The logTag prefix references the value of a specified tag in the original log record.

    Log Service provides the following standard tags:

    • __topic__: The business topic of the entire LogGroup, which can contain one or more logs. Expression format: ${logTag:__topic__}.

    • __source__: The IP address of the machine that generated the log record. Expression format: ${logTag:__source__}.

    • __time__: The timestamp of the log record, in seconds. Expression format: ${logTag:__time__}.

Submit the task

After configuring the parameters, click Submit to create the TSDB export task.

Next steps

  • The TSDB export task starts immediately after it is created. To pause the task or view its status, go to the Log Service console and click the task name to open the task management panel.

  • After the task is created, you can modify its configuration. For more information, see Modify an export task.