You can import trace data from Zipkin to Simple Log Service. You can also use the OpenTelemetry Collector to forward trace data to Simple Log Service.
Prerequisites
A trace instance is created. For more information, see Create a trace instance.
Import trace data from Zipkin
If you want to use the Zipkin protocol to import trace data to Simple Log Service, you must configure the endpoint and authentication settings in the Zipkin SDK. The following list describes the settings:
To ensure data security during transmission, you must import data over HTTPS.
Endpoint settings
HTTP 2.0: An HTTPS endpoint is in the ${endpoint}/zipkin/api/v2/spans format. Example: https://test-project.cn-hangzhou-intranet.log.aliyuncs.com/zipkin/api/v2/spans. We recommend that you use this type of endpoint.
HTTP 1.0: An HTTPS endpoint is in the ${endpoint}/zipkin/api/v1/spans format. Example: https://test-project.cn-hangzhou.log.aliyuncs.com/zipkin/api/v1/spans.
You must replace the ${endpoint} variable with the actual value. The following table describes the variable.
Table 1. Variable description
Variable
Description
Example
${endpoint}
The endpoint. The format is ${project}.${region-endpoint}, where:
${project}: the name of the Simple Log Service project.
${region-endpoint}: the Simple Log Service endpoint for the region where the project resides. You can access Simple Log Service by using a public or internal endpoint. A public endpoint is accessible over the Internet. An internal endpoint is accessible over the classic network or a virtual private cloud (VPC). For more information, see Endpoints.
test-project.cn-hangzhou.log.aliyuncs.com
Authentication settings
You can configure the authentication settings in HTTPS header fields. The following table describes the fields.
HTTPS header field
Description
Example
x-sls-otel-project
The name of the Simple Log Service project.
test-project
x-sls-otel-instance-id
The ID of the trace instance. For more information, see Create a trace instance.
test-traces
x-sls-otel-ak-id
The AccessKey ID of your Alibaba Cloud account.
We recommend that you use the AccessKey pair of a RAM user that has only the write permissions on the Simple Log Service project. An AccessKey pair consists of an AccessKey ID and an AccessKey secret. For more information about how to grant the write permissions on a specific project to a RAM user, see Use custom policies to grant permissions to a RAM user. For more information about how to obtain an AccessKey pair, see AccessKey pair.
None
x-sls-otel-ak-secret
The AccessKey secret of your Alibaba Cloud account.
We recommend that you use the AccessKey pair of a RAM user that has only the write permissions on the Simple Log Service project.
None
Use the OpenTelemetry Collector to forward trace data
You can use the Zipkin SDK to import trace data from Zipkin to the OpenTelemetry Collector, and then use the OpenTelemetry Collector to forward the data to Simple Log Service. This method supports data transmission over HTTP or HTTPS.
Install the OpenTelemetry Collector.
Configure the OpenTelemetry Collector.
Create a file named config.yaml.
Add the following code to the config.yaml file.
Replace the variables in the following code with the actual values. For more information about the variables, see Variable description.
receivers: zipkin: endpoint: 0.0.0.0:9411 exporters: logging/detail: loglevel: debug alibabacloud_logservice/traces: endpoint: "${endpoint}" project: "${project}" logstore: "${instance}-traces" access_key_id: "${access-key-id}" access_key_secret: "${access-key-secret}" service: pipelines: traces: receivers: [zipkin] # Set the receivers parameter to zipkin. exporters: [alibabacloud_logservice/traces] # Set the exporters parameter to alibabacloud_logservice/sls-traces. # for debug #exporters: [logging/detail,alibabacloud_logservice/traces]
Table 2. Variable description
Variable
Description
Example
${endpoint}
The endpoint of Simple Log Service. The format is ${region-endpoint}. ${region-endpoint} is actually the endpoint for the region where the Simple Log Service project resides. You can access Simple Log Service by using a public or internal endpoint. A public endpoint is accessible over the Internet. An internal endpoint is accessible over the classic network or a VPC. For more information, see Endpoints.
cn-hangzhou.log.aliyuncs.com
${project}
The name of the Simple Log Service project.
test-project
${instance}
The ID of the trace instance. For more information, see Create a trace instance.
test-traces
${access-key-id}
The AccessKey ID of your Alibaba Cloud account.
We recommend that you use the AccessKey pair of a RAM user that has only the write permissions on the Simple Log Service project. For more information about how to grant the write permissions on a specific project to a RAM user, see Use custom policies to grant permissions to a RAM user. For more information about how to obtain an AccessKey pair, see AccessKey pair.
None
${access-key-secret}
The AccessKey secret of your Alibaba Cloud account.
We recommend that you use the AccessKey pair of a RAM user that has only the write permissions on the Simple Log Service project.
None
Start the OpenTelemetry Collector.
./otelcontribcol_linux_amd64 --config="./config.yaml"
Configure Zipkin.
Change the output endpoint of Zipkin to an endpoint on which the OpenTelemetry Collector can listen. For example, if the endpoint of the OpenTelemetry Collector is ${collector-host}, change the output endpoint of Zipkin to ${collector-host}:9411.