All Products
Search
Document Center

Resource Orchestration Service:ALIYUN::SLS::Savedsearch

Last Updated:Apr 18, 2023

ALIYUN::SLS::Savedsearch is used to save search results as a saved search.

Syntax

{
  "Type": "ALIYUN::SLS::Savedsearch",
  "Properties": {
    "Project": String,
    "Detail": Map
  }
}

Properties

Property

Type

Required

Editable

Description

Constraint

Project

String

Yes

No

The name of the Log Service project.

None

Detail

Map

Yes

Yes

The details of the query.

For more information, see Detail properties.

Detail syntax

"Detail": {
  "SearchQuery": String,
  "Logstore": String,
  "DisplayName": String,
  "SavedsearchName": String,
  "Topic": String
}

Detail properties

Property

Type

Required

Editable

Description

Constraint

SearchQuery

String

Yes

Yes

The query statement.

None

Logstore

String

Yes

Yes

The Logstore in which the query is performed.

None

DisplayName

String

No

Yes

The display name that you specify for the saved search.

The name must be 1 to 63 characters in length.

SavedsearchName

String

Yes

No

The name of the saved search, which is generated by the system in the project.

None

Topic

String

Yes

Yes

The log topic that is used to classify logs.

None

Response parameters

Fn::GetAtt

SavedsearchName: the name of the saved search.

Examples

YAML format

ROSTemplateFormatVersion: '2015-09-01'
Parameters:
  SlsProjectName:
    Type: String
    Description: Project name
    MinLength: 3
    MaxLength: 63
    Default: mytest
Resources:
  SavedSearch:
    Type: ALIYUN::SLS::Savedsearch
    Properties:
      Project:
        Ref: SlsProjectName
      Detail:
        SearchQuery: '*|select date_format(__time__-__time__%60, ''%H:%i:%s'') as time, COUNT(*) as pv group by time'
        Logstore: aliyun-test-***
        DisplayName: displayname
        SavedsearchName: test
        Topic: test

JSON format

{
  "ROSTemplateFormatVersion": "2015-09-01",
  "Parameters": {
    "SlsProjectName": {
      "Type": "String",
      "Description": "Project name",
      "MinLength": 3,
      "MaxLength": 63,
      "Default": "mytest"
    }
  },
  "Resources": {
    "SavedSearch": {
      "Type": "ALIYUN::SLS::Savedsearch",
      "Properties": {
        "Project": {
          "Ref": "SlsProjectName"
        },
        "Detail": {
          "SearchQuery": "*|select date_format(__time__-__time__%60, '%H:%i:%s') as time, COUNT(*) as pv group by time",
          "Logstore": "aliyun-test-***",
          "DisplayName": "displayname",
          "SavedsearchName": "test",
          "Topic": "test"
        }
      }
    }
  }
}