You can import log files from an Object Storage Service (OSS) bucket to Simple Log Service (SLS) for query, analysis, and processing. Simple Log Service can import OSS files up to 5 GB. For compressed files, this limit applies to the compressed file size.
Billing
Simple Log Service does not charge for the data import feature. However, this feature incurs OSS API request and traffic fees. For more information about the pricing of billable items, see OSS Pricing. The daily OSS fees for importing data from OSS are calculated using the following formula:
![]()
Prerequisites
You have uploaded log files to an OSS bucket. For more information, see Upload objects.
You have created a project and a Logstore. For more information, see Manage projects and Create a Logstore.
You have completed Cloud Resource Access Authorization, granting Simple Log Service permission to access your OSS resources using the AliyunLogImportOSSRole role.
Your account has the
oss:ListBucketspermission. For more information, see Grant custom permissions to a RAM user.If you use a RAM user, you must also grant the
ram:PassRolepermission. The following policy is an example. For more information, see Create a custom policy and Grant permissions to a RAM user.{ "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" }
Create a data import configuration
If an imported file is updated, the job re-imports the entire file, including existing data.
Log on to the Simple Log Service console.
In the Import Data section, on the Data Import tab, click OSS - Data Import.
Select the destination project and Logstore, and then click Next.
Set the import parameters.
In the Import Configuration step, set the following parameters.
Click Preview to view the import results.
After you confirm that the configurations are correct, 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 go to the query and analysis page and confirm whether the OSS data has been successfully imported.
Wait about one minute. The import is successful if the data appears in the Logstore.
Related operations
After creating a data import configuration, you can view the configuration details and related statistical reports in the Simple Log Service console.
In the Projects section, click the destination project.
Navigate to , select the destination Logstore, select , and then click the configuration name.
View job
On the Import Configuration Overview page, view the basic information and statistical reports of the data import job.

Modify configuration
Click Modify Configuration to edit the import settings. For more information, see Set the import parameters.
Delete configuration
Click Delete Configuration to delete the import configuration.
WarningThis operation cannot be undone. Proceed with caution.
Stop job
Click Stop to stop the data import job.
Start job
Click Start to start the data import job.
FAQ
Issue | Cause | Solution |
No data is available for preview when importing files from the HDFS directory of a bucket. | Importing files from the HDFS directory is not supported. | If the HDFS service is enabled for the bucket, a .dlsdata directory is created by default under the OSS directory. You can import files from the .dlsdata directory. |
No data is displayed during preview. | The OSS bucket contains no files, the files have no data, or no files match the filter conditions. |
|
The data contains garbled characters. | The settings for Data Format, Compression Format, or Encoding Format are incorrect. | Confirm the actual format of the OSS files and adjust the Data Format, Compression Format, or Encoding Format settings. To fix existing garbled data, create a new Logstore and a new data import configuration. |
The timestamps of logs in Simple Log Service do not match the timestamps in the source data. | The time field was not specified when the import job was configured, or the time format or time zone was set incorrectly. | Specify the log time field and the correct time format and time zone. For more information, see Create a data import configuration. |
Data cannot be queried or analyzed after being imported. |
|
|
The number of imported data entries is less than expected. | Some files contain single lines of data that exceed 3 MB in size, causing the data to be dropped during the import process. For more information, see Data collection limits. | When you write data to OSS files, ensure that the size of a single line does not exceed 3 MB. |
The number of files and total amount of data are both large, but the import speed is slower than expected. Import speeds can normally reach 80 MB/s. | The number of Logstore shards is too small. For more information, see Performance limits. | If the number of Logstore shards is small, try increasing the number of shards to 10 or more and observe the latency. For more information, see Manage shards. |
Cannot select an OSS bucket when you create a data import configuration. | The AliyunLogImportOSSRole role has not been authorized. | Complete the authorization as described in the Prerequisites section of this topic. |
Some files are not imported. | The filter conditions are set incorrectly, or some files exceed 5 GB in size. For more information, see Data collection limits. |
|
Archived files are not imported. | The Import Archive Files switch is turned off. For more information, see Data collection limits. |
|
Multi-line text logs are parsed incorrectly. | The regular expression for the first line or last line is incorrect. | Verify that the regular expression for the first or last line is correct. |
The import of new files is significantly delayed. | There are too many existing files that match the file path prefix, and the OSS Metadata Indexing switch is turned off in the import configuration. | If the number of files that match the file path prefix is too large (over 1 million), you need to turn on the OSS Metadata Indexing switch in the import configuration. Otherwise, discovering new files will be very inefficient. |
An STS-related permission error occurs during creation. | The RAM user has insufficient permissions. |
|
Error handling
Error | Description |
File read failure | If an incomplete file error occurs during reading, for example, due to network anomalies or file damage, the import job automatically retries. If the read fails after three retries, the file is skipped. The retry interval is the same as the New File Check Cycle. If New File Check Cycle is set to Never Check, the retry interval is 5 minutes. |
Compression format parsing error | If an invalid file compression format error occurs during decompression, the import job skips that file. |
Data format parsing error |
|
OSS bucket does not exist | The import job retries periodically. After the bucket is re-created, the import job automatically resumes. |
Permission error | If a permission error occurs while reading from an OSS bucket or writing to an SLS Logstore, the import job retries periodically. After the permissions are corrected, the job automatically resumes. The import job does not skip any files when a permission error occurs. Therefore, after the permissions are corrected, the job automatically imports data from the unprocessed files in the bucket to the SLS Logstore. |
API reference
Actions | API operation |
Create an OSS import job | |
Update an OSS import job | |
Get an OSS import job | |
Delete an OSS import job | |
Start an OSS import job | |
Stop an OSS import job |
