You can import trace data from Jaeger to Simple Log Service, or forward the trace data to Simple Log Service by using the OpenTelemetry Collector.
Prerequisites
A trace instance is created. For more information, see Create a trace instance.
Import trace data from Jaeger
If you use the Jaeger protocol to import trace data to Simple Log Service, you must configure the endpoint and authentication settings in the Jaeger tracing platform. The following list describes the required settings:
Endpoint settings
An HTTPS endpoint is in the ${endpoint}/jaeger/api/traces format. Example: https://test-project.cn-hangzhou-intranet.log.aliyuncs.com/jaeger/api/traces.
A gRPC endpoint is in the ${endpoint}:10010 format. Example: test-project.cn-hangzhou-intranet.log.aliyuncs.com:10010.
ImportantIf you want to ensure data security during transmission, you must enable Transport Layer Security (TLS) when you use the gRPC protocol.
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 endpoint of the project. You can access Simple Log Service by using the public or internal endpoint of the project. An internal endpoint is used for access 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 the header of the gRPC or HTTPS protocol, or in the Tag field of the Jaeger protocol. The following table describes the required fields.
Jaeger Tag field
gRPC or HTTPS header key
Description
Example
sls.otel.project
x-sls-otel-project
The name of the Simple Log Service project.
test-project
sls.otel.instanceid
x-sls-otel-instance-id
The ID of the trace instance. For more information, see Create a trace instance.
test-traces
sls.otel.akid
x-sls-otel-ak-id
The AccessKey ID of your Alibaba Cloud account.
We recommend that you use the AccessKey pair of a Resource Access Management (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 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 information about how to obtain an AccessKey pair, see AccessKey pair.
None
sls.otel.aksecret
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
Forward trace data by using the OpenTelemetry Collector
Install the OpenTelemetry Collector.
Configure the OpenTelemetry Collector.
Create a config.yaml file.
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: jaeger: protocols: grpc: endpoint: 0.0.0.0:6831 thrift_binary: endpoint: 0.0.0.0:6832 thrift_compact: endpoint: 0.0.0.0:6833 thrift_http: endpoint: 0.0.0.0:6834 exporters: logging/detail: loglevel: debug alibabacloud_logservice/sls-trace: endpoint: "${endpoint}" project: "${project}" logstore: "${instance}-traces" access_key_id: "${access-key-id}" access_key_secret: "${access-key-secret}" service: pipelines: traces: receivers: [jaeger] # Set the receivers parameter to jaeger. exporters: [alibabacloud_logservice/sls-trace] # Set the exporters parameter to alibabacloud_logservice/sls-trace. # for debug #exporters: [logging/detail,alibabacloud_logservice/sls-trace]
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 of the Simple Log Service project. You can access Simple Log Service by using the public or internal endpoint of the project. An internal endpoint is used for access over the classic network or a VPC. For more information, see Endpoints.
cn-hangzhou.log.aliyuncs.com:10010
${project}
The name of the Simple Log Service project.
test-project
${instance}
The name 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 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 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 Jaeger.
Change the output endpoint of the Jaeger tracing system to an endpoint on which the OpenTelemetry Collector can listen. For example, if the endpoint of the OpenTelemetry Collector is ${collector-host}, you must change the output endpoint of the Jaeger tracing system to ${collector-host}:${port}/api/traces.
NoteIf an error is returned by the OpenTelemetry Collector because data fails to be parsed, you can switch between the four receiving modes of the Jaeger tracing system to troubleshoot the issue.