All Products
Search
Document Center

Security Center:SLS component

Last Updated:Nov 03, 2025

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.

Note

You can save the example data as a JSON file first, and then import it into the editor.

Example data

{
    "cells": [
        {
            "shape": "custom-edge",
            "zIndex": 1,
            "id": "SequenceFlow_0yvd0ew",
            "data": {
                "nodeType": "sequenceFlow",
                "appType": "basic",
                "icon": "icon-upper-right-arrow",
                "isRequired": false
            },
            "labels": [],
            "isNode": false,
            "source": {
                "cell": "Action_15qsqhz"
            },
            "target": {
                "cell": "32124b94-ecd0-4370-9878-c08676bacde4"
            },
            "vertices": []
        },
        {
            "position": {
                "x": -560,
                "y": 0
            },
            "size": {
                "width": 137,
                "height": 66
            },
            "view": "react-shape-view",
            "shape": "activity",
            "id": "Action_15qsqhz",
            "zIndex": 1,
            "data": {
                "nodeType": "action",
                "appType": "component",
                "nodeName": "SLS_1",
                "valueData": {
                    "query": "*",
                    "limit": "10",
                    "project": "test_project",
                    "from": "<%=currentTimeToMs()- 100 * 60 * 1000L%>",
                    "to": "<%=currentTimeToMs()%>",
                    "logstore": "test_logstore",
                    "endpoint": "cn-shangzhou.log.aliyuncs.com"
                },
                "icon": "https://sophon-gen-v2.oss-cn-zhangjiakou.aliyuncs.com/componentUpload/1641804391435_SLS_logo.svg?Expires=1745566401&OSSAccessKeyId=STS.NVuDNZvKqtwuTJkfJtY******&Signature=s3Rr36HjjDz%2Bqu5wx%2FaTAtTR0dc%3D&security-token=CAIS2AJ1q6Ft5B2yfSjIr5XAD%2FTum5RQw7WeVmzagkohVbkU2PzZrDz2IHhMenFpAegcv%2Fw%2BlGFZ6%2F8elrp6SJtIXleCZtF94oxN9h2gb4fb40wIXRWK0s%2FLI3OaLjKm9u2wCryLYbGwU%2FOpbE%2B%2B5U0X6LDmdDKkckW4OJmS8%2FBOZcgWWQ%2FKBlgvRq0hRG1YpdQdKGHaONu0LxfumRCwNkdzvRdmgm4NgsbWgO%2Fks0OP3AOrlrBN%2Bdiuf8T9NvMBZskvD42Hu8VtbbfE3SJq7BxHybx7lqQs%2B02c5onDWwAJu0%2FXa7uEo4wydVNjFbM9A65Dqufxn%2Fpgt%2Braj4X7xhhEIOVJSSPbSZBbSxJNvU1RXDxQVcEYWxylurjnXvF%2Bo5q63vwUGin%2B2svzhw6RGJ1dq8DgINtD0jokjPndRVbLXs84nxS7gbsGn76oY2zradH%2FdU4il8CyMytAXxqAAZDNL%2FMfqwnfpUW9RMOXa9Q0%2FU5jug3GzZT64g7TdTWpUYEW9f10E3bF%2BHv5B%2Bd9c5yYLrOjVRiwJ7hkN8GRS67b55hST1lWccu6vd%2FKBk9qxZbSc02pD7ymERlhj7sts0FXMLuYlYqc%2BSSGF8vK0GW%2F%2FST%2FLdOTF2wDJB4C9oTCIAA%3D",
                "advance": {
                    "inputParamMode": false,
                    "onError": "stop_cur_flow",
                    "rspStatusType": "3",
                    "rspStatusThreshold": "0",
                    "description": "Query logs from SLS"
                },
                "componentName": "SLS",
                "actionName": "run_query",
                "assetUuid": "54c20873-deb3-4474-bdc2-12aba357acb4",
                "cascaderValue": []
            },
            "isNode": true
        },
        {
            "position": {
                "x": -788,
                "y": 15
            },
            "size": {
                "width": 36,
                "height": 36
            },
            "attrs": {
                "body": {
                    "fill": "white",
                    "strokeOpacity": 0.95,
                    "stroke": "black",
                    "strokeWidth": 2
                },
                "label": {
                    "text": "",
                    "fontSize": 12,
                    "refX": 0.5,
                    "refY": "100%",
                    "refY2": 4,
                    "textAnchor": "middle",
                    "textVerticalAnchor": "top"
                }
            },
            "visible": true,
            "shape": "circle",
            "id": "StartEvent_1",
            "zIndex": 1,
            "data": {
                "nodeType": "startEvent",
                "appType": "basic",
                "valueData": {},
                "icon": "icon-circle"
            },
            "markup": [
                {
                    "tagName": "circle",
                    "selector": "body"
                },
                {
                    "tagName": "text",
                    "selector": "label"
                }
            ],
            "isNode": true
        },
        {
            "position": {
                "x": -21,
                "y": 25
            },
            "size": {
                "width": 36,
                "height": 36
            },
            "attrs": {
                "body": {
                    "fill": "white",
                    "strokeOpacity": 0.95,
                    "stroke": "black",
                    "strokeWidth": 2
                },
                "path": {
                    "r": 12,
                    "refX": "50%",
                    "refY": "50%",
                    "fill": "black",
                    "strokeOpacity": 0.95,
                    "stroke": "black",
                    "strokeWidth": 4
                },
                "label": {
                    "text": "",
                    "fontSize": 12,
                    "refX": 0.5,
                    "refY": "100%",
                    "refY2": 4,
                    "textAnchor": "middle",
                    "textVerticalAnchor": "top"
                }
            },
            "visible": true,
            "shape": "circle",
            "id": "EndEvent_1bi7n65",
            "zIndex": 1,
            "data": {
                "nodeType": "endEvent",
                "appType": "basic",
                "valueData": {},
                "icon": "icon-radio-off-full"
            },
            "markup": [
                {
                    "tagName": "circle",
                    "selector": "body"
                },
                {
                    "tagName": "circle",
                    "selector": "path"
                },
                {
                    "tagName": "text",
                    "selector": "label"
                }
            ],
            "isNode": true
        },
        {
            "shape": "custom-edge",
            "zIndex": 1,
            "id": "SequenceFlow_0d1fm8e",
            "data": {
                "nodeType": "sequenceFlow",
                "appType": "basic",
                "icon": "icon-upper-right-arrow",
                "isRequired": false
            },
            "labels": [],
            "isNode": false,
            "source": {
                "cell": "StartEvent_1"
            },
            "target": {
                "cell": "Action_15qsqhz"
            },
            "vertices": [],
            "visible": true,
            "router": {
                "name": "manhattan",
                "args": {
                    "padding": 5,
                    "excludeHiddenNodes": true,
                    "excludeNodes": [
                        "clone_node_id"
                    ]
                }
            }
        },
        {
            "position": {
                "x": -304,
                "y": 0
            },
            "size": {
                "width": 137,
                "height": 66
            },
            "view": "react-shape-view",
            "shape": "activity",
            "id": "32124b94-ecd0-4370-9878-c08676bacde4",
            "zIndex": 1,
            "data": {
                "nodeType": "action",
                "appType": "component",
                "nodeName": "SLS_2",
                "valueData": {
                    "logItems": "{\"test\":\"test\"}",
                    "project": "test_project",
                    "logstore": "test_logstore",
                    "endpoint": "cn-shangzhou.log.aliyuncs.com",
                    "topic": "test"
                },
                "icon": "https://sophon-gen-v2.oss-cn-zhangjiakou.aliyuncs.com/componentUpload/1641804391435_SLS_logo.svg?Expires=1745566401&OSSAccessKeyId=STS.NVuDNZvKqtwuTJkfJtY******&Signature=s3Rr36HjjDz%2Bqu5wx%2FaTAtTR0dc%3D&security-token=CAIS2AJ1q6Ft5B2yfSjIr5XAD%2FTum5RQw7WeVmzagkohVbkU2PzZrDz2IHhMenFpAegcv%2Fw%2BlGFZ6%2F8elrp6SJtIXleCZtF94oxN9h2gb4fb40wIXRWK0s%2FLI3OaLjKm9u2wCryLYbGwU%2FOpbE%2B%2B5U0X6LDmdDKkckW4OJmS8%2FBOZcgWWQ%2FKBlgvRq0hRG1YpdQdKGHaONu0LxfumRCwNkdzvRdmgm4NgsbWgO%2Fks0OP3AOrlrBN%2Bdiuf8T9NvMBZskvD42Hu8VtbbfE3SJq7BxHybx7lqQs%2B02c5onDWwAJu0%2FXa7uEo4wydVNjFbM9A65Dqufxn%2Fpgt%2Braj4X7xhhEIOVJSSPbSZBbSxJNvU1RXDxQVcEYWxylurjnXvF%2Bo5q63vwUGin%2B2svzhw6RGJ1dq8DgINtD0jokjPndRVbLXs84nxS7gbsGn76oY2zradH%2FdU4il8CyMytAXxqAAZDNL%2FMfqwnfpUW9RMOXa9Q0%2FU5jug3GzZT64g7TdTWpUYEW9f10E3bF%2BHv5B%2Bd9c5yYLrOjVRiwJ7hkN8GRS67b55hST1lWccu6vd%2FKBk9qxZbSc02pD7ymERlhj7sts0FXMLuYlYqc%2BSSGF8vK0GW%2F%2FST%2FLdOTF2wDJB4C9oTCIAA%3D",
                "description": "Write data to SLS",
                "advance": {
                    "inputParamMode": false,
                    "onError": "stop_cur_flow",
                    "rspStatusType": 3,
                    "rspStatusThreshold": 0
                },
                "componentName": "SLS",
                "actionName": "putLogs",
                "assetUuid": "54c20873-deb3-4474-bdc2-12aba357acb4",
                "cascaderValue": [
                    {
                        "label": "SLS_1",
                        "value": "${SLS_1}",
                        "children": []
                    }
                ]
            },
            "isNode": true
        },
        {
            "shape": "custom-edge",
            "zIndex": 1,
            "id": "0823a20d-6441-4cef-83e0-0d04dc14fc3b",
            "data": {
                "nodeType": "sequenceFlow",
                "appType": "basic",
                "icon": "icon-upper-right-arrow",
                "isRequired": false
            },
            "labels": [],
            "isNode": false,
            "source": {
                "cell": "32124b94-ecd0-4370-9878-c08676bacde4"
            },
            "target": {
                "cell": "EndEvent_1bi7n65"
            },
            "vertices": []
        }
    ]
}

Instance configuration

To use the SLS logging component, you need to configure the related information of Simple Log Service first. Follow these steps:

  1. Click the component, and in the Basic Information Configuration tab, click Resource Instance Configuration.

  2. 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.

    Important

    If 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.