You can import log files from Object Storage Service (OSS) buckets into Simple Log Service to query, analyze, and transform them. Simple Log Service imports OSS objects up to 5 GB. For compressed objects, this limit applies to their compressed size.
Billing
Simple Log Service does not charge for the data import feature. However, this feature calls Object Storage Service (OSS) APIs, which incurs OSS traffic fees and request fees. For more information about the pricing of related billable items, see OSS Pricing. The daily OSS fee for importing data from OSS is calculated using the following formula:
![]()
Same-region import
A company develops App A based on Alibaba Cloud products such as Object Storage Service (OSS) and Simple Log Service (SLS). The app generates 100,000 files per day. Each file has an average size of 100 MB. These files are stored in a Standard OSS bucket in the China (Hangzhou) region. The company wants to import this data into an SLS Logstore in the China (Hangzhou) region and sets the New File Check Cycle to 5 minutes. The daily OSS cost is CNY 0.114592. The following table describes the cost breakdown.
|
Billable item |
Price |
Usage |
Daily cost |
|
PUT requests |
CNY 0.01 per 10,000 requests |
14,592 requests |
14,592 / 10,000 × CNY 0.01 = CNY 0.014592 |
|
GET requests |
CNY 0.01 per 10,000 requests |
100,000 requests |
100,000 / 10,000 × CNY 0.01 = CNY 0.1 |
|
Total cost |
CNY 0.114592 |
||
Cross-region import (daily)
A company develops App B based on Alibaba Cloud products such as Object Storage Service (OSS) and Simple Log Service (SLS). The app generates 100,000 files per day. Each file has an average size of 100 MB. These files are stored in a Standard OSS bucket in the China (Shanghai) region. The company wants to import this data into an SLS Logstore in the China (Hangzhou) region and sets the New File Check Cycle to 1 day. The daily OSS cost is CNY 2500.1001. The following table describes the cost breakdown.
|
Billable item |
Price |
Usage |
Daily cost |
|
PUT requests |
CNY 0.01 per 10,000 requests |
100 requests |
100 / 10,000 × CNY 0.01 = CNY 0.0001 |
|
GET requests |
CNY 0.01 per 10,000 requests |
100,000 requests |
100,000 / 10,000 × CNY 0.01 = CNY 0.1 |
|
outbound internet traffic |
CNY 0.25/GB |
10,000 GB |
10,000 GB × CNY 0.25/GB = CNY 2,500 |
|
Total cost |
CNY 2500.1001 |
||
Cross-region import (5 min)
A company develops App C based on Alibaba Cloud products such as Object Storage Service (OSS) and Simple Log Service (SLS). The app generates 100,000 files per day. Each file has an average size of 100 MB. These files are stored in a Standard OSS bucket in the China (Shanghai) region. The company wants to import this data into an SLS Logstore in the China (Hangzhou) region and sets the New File Check Cycle to 5 minutes. The daily OSS cost is CNY 4375.114592. The following table describes the cost breakdown.
|
Billable item |
Price |
Usage |
Daily cost |
|
PUT requests |
CNY 0.01 per 10,000 requests |
14,592 requests |
14,592 / 10,000 × CNY 0.01 = CNY 0.014592 |
|
GET requests |
CNY 0.01 per 10,000 requests |
100,000 requests |
100,000 / 10,000 × CNY 0.01 = CNY 0.1 |
|
outbound internet traffic |
00:00 to 08:00: CNY 0.25/GB 08:00 to 24:00: CNY 0.50/GB |
10,000 GB |
CNY 4,375 |
|
Total cost |
CNY 4375.114592 |
||
Prerequisites
-
Log files are uploaded to an Object Storage Service (OSS) bucket. For more information, see Upload objects.
-
A Project and a Logstore are created. For more information, see Manage projects and Create a basic Logstore.
-
You have completed Cloud Resource Access Authorization, which authorizes Simple Log Service to access your OSS resources with the AliyunLogImportOSSRole role.
-
Your account has the oss:ListBuckets permission to list OSS buckets. For more information, see Attach a custom policy to a RAM user.
If you use a RAM user, you must also grant the RAM user the PassRole permission. For more information, see Create a custom policy and Manage RAM user permissions.
{ "Statement": [ { "Effect": "Allow", "Action": ["ram:PassRole", "ram:GetRole"], "Resource": "acs:ram:*:*:role/aliyunlogimportossrole" }, { "Effect": "Allow", "Action": "oss:GetBucketWebsite", "Resource": "*" }, { "Effect": "Allow", "Action": "oss:ListBuckets", "Resource": "*" } ], "Version": "1" }If you want to import data across accounts, root account B must first authorize Account A and a role within Account A using a Bucket Policy in the OSS console. Example role:
acs:ram::123456789:role/aliyunlogimportossrole.
Create a data import configuration
If you append data to an OSS file that has already been imported, the data import job re-imports the entire file.
Log on to the Simple Log Service console.
-
In the Import Data section, click the Data Import tab, and then click OSS - Data Import.
-
Select the destination project and Logstore, and then click Next.
-
Set the import configuration.
-
In the Import Configuration step, configure the following parameters.
-
Click Preview to preview the import results.
-
Once you confirm the settings, click Next.
-
Create indexes and preview data. Then, click Next. By default, full-text indexing is enabled in Simple Log Service. You can also manually create field indexes for the collected logs or click Automatic Index Generation. Then, Simple Log Service generates field indexes. For more information, see Create indexes.
ImportantIf you want to query all fields in logs, we recommend that you use full-text indexes. If you want to query only specific fields, we recommend that you use field indexes. This helps reduce index traffic. If you want to analyze fields, you must create field indexes. You must include a SELECT statement in your query statement for analysis.
-
Click Query Log to open the query and analysis page and check if the OSS data was imported successfully.
Wait for about one minute. If the target OSS data appears, the import was successful.
Related operations
After creating a data import configuration, you can view the configuration and its statistical reports in the console.
-
In the Project list, click the desired Project.
-
In the left-side navigation pane, choose . On the page that appears, find the desired Logstore, choose , and click the configuration name.
-
Overview
On the Import Configuration Overview page, you can view the configuration's basic information and statistical reports.
The Import Configuration Overview page contains the following information: The Basic Information section displays parameters such as Configuration Name, Status, Bucket, Compression Format, Encoding Format, File Path Regex Filter, Import Archive Files, OSS Region, New File Check Interval, Data Format, and Use System Time. The Statistical Reports (Data Processing Insight) section shows six metrics: Successful Reads, Failed Reads, Public Read Traffic, Successful Writes, Failed Writes, and Public Write Traffic, as well as a Processing Rate Line Chart and a Progress Lag Chart. The Running Status table at the bottom lists information for each task, such as Time, Type, Instance, Successful Items, Failed Items, and Average Response Time. The top-right corner provides the Edit Configurations, Stop, and Delete Configuration action buttons.
Modify
Click Edit Configurations to modify the data import configuration. For more information, see Create a data import configuration.
Delete
Click Delete Configuration to remove the data import configuration.
WarningThis operation is irreversible. Proceed with caution.
Stop
To stop the data import task, click Stop.
Start
Click Start to begin the data import task.
FAQ
|
Problem |
Possible cause |
Solution |
|
When I preview files from an HDFS directory in my bucket, no data is displayed. |
Importing files directly from an HDFS directory is not supported. |
If the HDFS service is enabled for the bucket, a |
|
No data is displayed during preview. |
The OSS bucket contains no files, the files are empty, or no files match the filter conditions. |
|
|
The imported data contains garbled characters. |
The data format, compression format, or encoding format is incorrect. |
Confirm the actual format of the OSS file, and then adjust settings such as Data Format, Compression Format, or Encoding Format. To fix existing garbled data, create a new Logstore and a new data import configuration. |
|
The timestamps in Simple Log Service do not match the timestamps in the source data. |
The data import configuration is missing the log time field, or the time format or time zone is incorrect. |
Specify the log time field and configure the correct time format and time zone. For more information, see Create a data import configuration. |
|
After data is imported, I cannot query or analyze it. |
|
|
|
The number of imported entries is less than expected. |
Some files contain single lines of data that exceed the 3 MB limit and are dropped during the import process. For more information, see Collection limits. |
When you write data to OSS files, ensure that no single line of data exceeds 3 MB. |
|
When I create a data import configuration, I cannot select an OSS bucket. |
Simple Log Service has not been authorized to assume the |
Complete the authorization as described in the prerequisites. |
|
Some files are not imported. |
The filter conditions are configured incorrectly, or some files exceed the 5 GB size limit. For more information, see Collection limits. |
|
|
Archive files are not imported. |
The Import Archive Files switch is turned off. For more information, see Collection limits. |
|
|
Multi-line text logs are parsed incorrectly. |
The first-line regular expression or last-line regular expression is configured incorrectly. |
Correct the first-line and last-line regular expressions. |
|
Import latency for new files is high. |
There are too many existing files that match the file path prefix filter, and the OSS Metadata Indexing switch is turned off in the data import configuration. |
If a large number of files (more than one million) match the file path prefix filter, you must turn on the OSS Metadata Indexing switch in the data import configuration. Otherwise, new file discovery becomes very slow. |
|
An STS-related permission error occurs during creation. |
The RAM user has insufficient permissions. |
|
Error handling
|
Error |
Description |
|
Object read failure |
If a data import job cannot completely read an object, for example, due to a network exception or object damage, it automatically retries. If the read operation still fails after three attempts, the job skips the object. The retry interval is the same as the New File Check Cycle. If New File Check Cycle is set to Never Check, the job retries after 5 minutes. |
|
Compression format parsing error |
If a data import job encounters an object with an invalid compression format, it skips the object. |
|
Data format parsing error |
|
|
OSS bucket not found |
The data import job retries periodically. The job automatically resumes importing after the OSS bucket is recreated. |
|
Permission error |
If a permission error occurs while reading from an OSS bucket or writing to a Logstore, the data import job retries periodically. The job resumes automatically once the permission issue is resolved. The data import job does not skip any objects during a permission error. Therefore, after the permissions are corrected, the job processes all unprocessed objects in the OSS bucket, importing their data into the Logstore. |
OSS ingestion API
|
Actions |
API |
|
Create an OSS data import job |
|
|
Update an OSS data import job |
|
|
Get an OSS data import job |
|
|
Delete an OSS data import job |
|
|
Start an OSS data import job |
|
|
Stop an OSS data import job |