The SLS component primarily provides SLS log query and write capabilities.
Feature description
Action | Description | Scenarios |
run_query | Queries SLS logs. | Queries SLS logs. |
putLogs | Writes logs to SLS. | Writes logs to SLS. |
Configuration examples
This topic provides parameter configuration examples for each action of the SLS component. You can import them as test playbooks. Through the visual flow editor, you can more intuitively understand and test the configuration parameters of each action, and easily master the functional logic and usage of the component. For the procedure, see Playbook import.
You can save the example data as a JSON file first, and then import it into the editor.
Instance configuration
To use the SLS logging component, you need to configure the related information of Simple Log Service first. Follow these steps:
Click the component, and in the Basic Information Configuration tab, click Resource Instance Configuration.
On the Resource Instance Configuration page, click the Add button. Complete the configuration as follows:
Parameter
Description
assetname
You can customize the resource name according to your business needs.
end_point
The access address of the SLS service. For more information about access addresses, see Service endpoints.
sub_id
The AccessKey ID of the user who can operate Simple Log Service. For information about how to create an AccessKey, see Create an AccessKey.
access_key
The AccessKey Secret of the user who can operate Simple Log Service.
ImportantIf you use the AccessKey information of a RAM user, make sure that the RAM user has the permission to operate Simple Log Service APIs.
run_query
Parameters
Parameter | Description |
project | The name of the SLS project to access. |
logstore | The name of the SLS logstore to access. |
endpoint | The access address of the SLS service. For more information about access addresses, see Service endpoints. |
query | The SQL syntax for querying SLS. For more information about SQL syntax, see SQL syntax and functions. Important If you use an analysis statement and the configured limit exceeds 100, you must configure the order by field. Otherwise, some data cannot be queried. |
from | The start time of the query, in milliseconds. |
to | The end time of the query, in milliseconds. |
limit | The maximum number of entries, with an upper limit of 10,000. |
PutLogs action
Parameters
Parameter | Description |
project | The name of the SLS project to access. |
logstore | The name of the SLS logstore to access. |
endpoint | The access address of the SLS service. |
topic | A user-defined field used to mark a batch of logs. |
logItems | The log information to write. The log format only supports JSON format string, JSONObject 3, and JSONArray, such as {"test":"test"}. Note A _logUuid field will be added to each log entry as a unique identifier when writing, making it easier for users to query recently written logs. |