This topic provides the DDL syntax that is used to create a Log Service result table, describes the parameters in the WITH clause, and provides data type mappings and references.

What is Log Service?

Log Service is an end-to-end data logging service. Log Service allows you to collect, consume, ship, query, and analyze log data in a quick manner. It improves the operations and maintenance (O&M) efficiency, and provides the capability to process large amounts of data. Log Service is used to store streaming data. This way, Flink can use the streaming data that is stored in Log Service as output data.

Prerequisites

A project and a Logstore of Log Service are created. For more information, see Step 2: Create a project and a Logstore.

Limits

Only Flink that uses Ververica Runtime (VVR) 2.0.0 or later supports Log Service connectors.

DDL syntax

create table sls_sink(
 name varchar,
 age int,
 birthday int
)with(
 'connector'='sls',
 'endPoint'='<endPoint>',
 'accessId'='<yourAccessId>',
 'accessKey'='<yourAccessKey>',
 'project'='<yourProjectName>',
 'logstore'='<yourLogstoreName>'
);

Parameters in the WITH clause

Parameter Description Required Remarks
connector The type of the result table. Yes Set the value to sls.
endPoint The endpoint of Log Service. Yes For more information, see Endpoints.
project The name of a project. Yes N/A.
logstore The name of the table in the database. Yes N/A.
accessId The AccessKey ID that is used to access Log Service. Yes N/A.
accessKey The AccessKey secret that is used to access Log Service. Yes N/A.

Data type mapping

The following table lists the data type mappings between Log Service and Flink fields. We recommend that you declare the mappings in a DDL statement.

Data type of Log Service Data type of Flink
STRING VARCHAR