Copy a Logstore
If you need to keep multiple copies of data from a Logstore, you can use the data transformation feature. This topic describes its use cases and procedure.
Use cases
A company's access logs are collected and stored in multiple projects under the same Alibaba Cloud account. You need to copy the access logs from project-a in logstore-a to logstore-b in a new project-b to centralize queries and analysis in project-b. The data transformation feature of Log Service provides a replication function that can copy data from logstore-a to logstore-b.
Prerequisites
You have created
logstore-aand written data to it. For more information, see Manage a Logstore.You have created
logstore-band planned its capacity, such as the number of shards, based on your performance requirements. For more information, see Performance guide.
Procedure
Log on to the Simple Log Service console.
In the project list, click
project-a.On the tab, click logstore-a.
Click Data Transformation to open the data transformation editor.
In the editor, leave the SPL statement empty or enter
*.Preview the data.
On the Raw Data tab, click Add to Test, or manually enter test data on the Test Data tab.
Create a data transformation job.
Click Save as Transformation Job (New).
In the Create Data Transformation Job (New) panel, configure the following parameters and click OK.
NoteFor more information about the parameters, see Create a data transformation job (new version).
Parameter
Description
Job name
The name of the data transformation job. Use the default value.
Display name
A custom name for the job. For example, enter
test.Authorization method
Grants Log Service permission to read data from
logstore-a. For this example, select Default Role.Storage target name
The name of the storage target. Enter test.
Destination region
The region where the destination project resides. Select China (Hangzhou).
Destination project
The name of the project to which Logstore-b belongs. Enter project-b.
Destination logstore
The name of the destination Logstore. Enter logstore-b.
Authorization method
Grants Log Service permission to write data to
logstore-b.For this example, select Default Role.
Time range
The time range for data transformation. The job continuously processes data from the beginning of the source Logstore until manually stopped. Select All.
Verify the result
Check the status of the data transformation job. For more information about the parameters on the job page, see Manage data transformation jobs.
In the left-side navigation pane, choose Job Management > Data Transformation. Click the name of the job to view its status and other basic information in the Data Transformation Overview panel on the right.
Go to the
project-bproject. On the tab, selectlogstore-bto open the query and analysis page.In the upper-right corner of the page, click Enable Index. For more information about indexes, see Create indexes.
View the data copied from
logstore-a. The query result shows that the logs are successfully copied tologstore-b. The value of the__source__field isactiontrail_internal, and the value of the__topic__field isactiontrail_audit_event.