All Products
Search
Document Center

Simple Log Service:CreateLogtailPipelineConfig

最終更新日:Dec 23, 2024

Creates a Logtail pipeline configuration.

Operation description

The UK (London) region is supported. Supported regions are constantly updated.

Debugging

You can run this interface directly in OpenAPI Explorer, saving you the trouble of calculating signatures. After running successfully, OpenAPI Explorer can automatically generate SDK code samples.

Authorization information

There is currently no authorization information disclosed in the API.

Request syntax

POST /pipelineconfigs HTTP/1.1

Request parameters

ParameterTypeRequiredDescriptionExample
projectstringYes

The name of the project.

test-project
bodyobjectNo

The content of the Logtail pipeline configuration.

configNamestringYes

The name of the configuration.

Note The name of the configuration must be unique in the project to which the configuration belongs. After the configuration is created, you cannot change the name of the configuration. The name must meet the following requirements:
  • The name can contain only lowercase letters, digits, hyphens (-), and underscores (_).

  • The name must start and end with a lowercase letter or a digit.

  • The name must be 2 to 128 characters in length.

test-config
logSamplestringNo

The sample log. You can specify multiple sample logs.

2022-06-14 11:13:29.796 | DEBUG | __main__:<module>:1 - hello world
globalobjectNo

The global settings.

inputsarray<object>Yes

The input plug-ins.

Note You can configure only one input plug-in.
objectNo

The input plug-in.

Note For more information about the parameters of the plug-in for collecting text logs, see Plug-in for collecting text logs. For more information about the parameters of other input plug-ins, see Overview of Logtail plug-ins for data processing.
{ "Type": "input_file", "FilePaths": ["/var/log/*.log"] }
processorsarray<object>No

The processing plug-ins.

Note Logtail plug-ins for data processing are classified into native plug-ins and extended plug-ins. For more information, see Overview of Logtail plug-ins for data processing.
Note
  • You can use native plug-ins only to collect text logs.

  • You cannot add native plug-ins and extended plug-ins at a time.

  • When you add native plug-ins, take note of the following items:

    • You must add one of the following Logtail plug-ins for data processing as the first plug-in: Data Parsing (Regex Mode), Data Parsing (Delimiter Mode), Data Parsing (JSON Mode), Data Parsing (NGINX Mode), Data Parsing (Apache Mode), and Data Parsing (IIS Mode).
    • After you add the first plug-in, you can add one Time Parsing plug-in, one Data Filtering plug-in, and multiple Data Masking plug-ins.
objectNo

The processing plug-in.

Note For more information about native plug-ins and extended plug-ins, see Overview of Logtail plug-ins for data processing.
{ "Type": "processor_parse_json_native", "SourceKey": "content" }
aggregatorsarray<object>No

The aggregation plug-ins.

Note This parameter takes effect only when extended plug-ins are used. You can use only one aggregation plug-in.
objectNo

The aggregation plug-in.

flushersarray<object>Yes

The output plug-ins.

Note You can configure only one output plug-in.
objectNo

The output plug-in.

{ "Type": "flusher_sls", "Logstore": "test" }

Global settings

ParameterTypeRequiredDefault valueExampleDescription
TopicTypestringNoEmptyfilepathThe type of the topic. Valid values:
  • filepath: The information that is extracted from the log file path is used as the topic of the collected logs. This parameter takes effect only when the value of Type provided in the "Plug-in for collecting text logs" section is set to input_file.
  • machine_group_topic: The topic of the machine group to which the configuration is applied is used as the topic of the collected logs.
  • custom: You can specify a custom topic for the collected logs. For more information, see Log topics.
TopicFormatstringNo (This parameter is required if you set TopicType to filepath or custom.)//var/log/(.*).logThe format of the topic.
EnableTimestampNanosecondboolNofalsefalseSpecifies whether to extract timestamps that are accurate to the nanosecond.

Input plug-ins

Plug-in for collecting text logs

ParameterTypeRequiredDefault valueExampleDescription
TypestringYes/input_fileThe type of the plug-in. Set the value to input_file.
FilePaths[string]Yes/["/var/log/*.log"]The paths to the files from which you want to collect logs. You can specify only one path. You can use wildcard characters (* and **) to specify a log file path. You can use the wildcard character (**) only once in a path, and you must place it before the file name.
MaxDirSearchDepthuintNo00The number of levels of subdirectories that can be matched for the wildcard character (**) in the log file path. This parameter takes effect only when the wildcard character (**) exists in the log file path. Valid values: 0 to 1000.
ExcludeFilePaths[string]NoEmpty["/home/admin/*.log"]The blacklist of file paths. A path must be an absolute path. You can use the wildcard character (*).
ExcludeFiles[string]NoEmpty["app*.log", "password"]The blacklist of file names. You can use the wildcard character (*).
ExcludeDirs[string]NoEmpty["/home/admin/dir1", "/home/admin/dir2*"]The blacklist of directories. A directory must be an absolute path. You can use the wildcard character (*).
FileEncodingstringNoutf8utf8The encoding format of the files. Valid values: utf8 and gbk.
TailSizeKBuintNo10241024The size of data that Logtail can collect from a log file the first time Logtail collects logs from the file. If the file size is less than this value, Logtail collects data from the beginning of the file. Valid values: 0 to 10485760. Unit: KB.
MultilineobjectNoEmpty/The multi-line aggregation options.
Multiline.ModestringNocustomcustomThe multi-line aggregation mode. Valid values: custom and JSON.
Multiline.StartPatternstringThis parameter is required if you set Multiline.Mode to custom.Empty\d+-\d+-\d+.*The regular expression that is used to match the beginning of the first line of a log.
EnableContainerDiscoveryboolNofalsetrueSpecifies whether to enable the container discovery feature. This parameter takes effect only when Logtail runs in DaemonSet mode and the log file path is an in-container path.
ContainerFiltersobjectNoEmpty/The container filter options. Multiple options are evaluated by using a logical AND. This parameter takes effect only when EnableContainerDiscovery is set to true.
ContainerFilters.K8sNamespaceRegexstringNoEmptydefaultThe namespace of the pods to which the required containers belong. The containers refer to Kubernetes containers from which you want to collect data. If you do not specify this parameter, Logtail collects data from all containers. Regular expression matching is supported.
ContainerFilters.K8sPodRegexstringNoEmptytest-podThe name of the pods to which the required containers belong. The containers refer to Kubernetes containers from which you want to collect data. If you do not specify this parameter, Logtail collects data from all containers. Regular expression matching is supported.
ContainerFilters.IncludeK8sLabelmapNoEmpty/The labels of the pods to which the required containers belong. The containers refer to Kubernetes containers from which you want to collect data. The labels are also referred to as conditions. Multiple conditions are evaluated by using a logical OR. If you do not specify this parameter, Logtail collects data from all containers. Regular expression matching is supported. To create a map, specify the name of a pod label as the key of the map, and specify the value of the pod label as the value of the map.
  • If the value of the map is empty, the pods whose labels contain the key are matched.
  • If the value of the map is not empty, take note of the following information:
    • If the value starts with a caret (^) and ends with a dollar sign ($), the pods that meet the following conditions are matched: The name of a pod label contains the key of the map, and the value of the pod label matches the regular expression specified by the value of the map.
    • In other cases, the pods whose labels exactly match the key and value of the map are matched.
ContainerFilters.ExcludeK8sLabelmapNoEmpty/The labels of the pods to which the required containers do not belong. The containers refer to Kubernetes containers from which you want to collect data. Multiple conditions are evaluated by using a logical OR. If you do not specify this parameter, Logtail collects data from all containers. Regular expression matching is supported. To create a map, specify the name of a pod label as the key of the map, and specify the value of the pod label as the value of the map.
  • If the value of the map is empty, the pods whose labels contain the key are matched.
  • If the value of the map is not empty, take note of the following information:
    • If the value starts with a caret (^) and ends with a dollar sign ($), the pods that meet the following conditions are matched: The name of a pod label contains the key of the map, and the value of the pod label matches the regular expression specified by the value of the map.
    • In other cases, the pods whose labels exactly match the key and value of the map are matched.
ContainerFilters.K8sContainerRegexstringNoEmptytest-containerThe name of the required containers. The containers refer to Kubernetes containers from which you want to collect data. If you do not specify this parameter, Logtail collects data from all containers. Regular expression matching is supported.
ContainerFilters.IncludeEnvmapNoEmpty/The environment variables of the containers from which you want to collect data. The environment variables are also referred to as conditions. Multiple conditions are evaluated by using a logical OR. If you do not specify this parameter, Logtail collects data from all containers. Regular expression matching is supported. To create a map, specify the name of an environment variable as the key of the map, and specify the value of the environment variable as the value of the map.
  • If the value of the map is empty, the containers whose environment variables contain the key are matched.
  • If the value of the map is not empty, take note of the following information:
    • If the value starts with a caret (^) and ends with a dollar sign ($), the containers that meet the following conditions are matched: The name of an environment variable is the key of the map, and the value of the environment variable matches the regular expression specified by the value of the map.
    • In other cases, the containers whose environment variables exactly match the key and value of the map are matched.
ContainerFilters.ExcludeEnvmapNoEmpty/The environment variables of the containers from which you do not want to collect data. Multiple conditions are evaluated by using a logical OR. If you do not specify this parameter, Logtail collects data from all containers. Regular expression matching is supported. To create a map, specify the name of an environment variable as the key of the map, and specify the value of the environment variable as the value of the map.
  • If the value of the map is empty, the containers whose environment variables contain the key are matched.
  • If the value of the map is not empty, take note of the following information:
    • If the value starts with a caret (^) and ends with a dollar sign ($), the containers that meet the following conditions are matched: The name of an environment variable is the key of the map, and the value of the environment variable matches the regular expression specified by the value of the map.
    • In other cases, the containers whose environment variables exactly match the key and value of the map are matched.
ContainerFilters.IncludeContainerLabelmapNoEmpty/The labels of the containers from which you want to collect data. Multiple conditions are evaluated by using a logical OR. If you do not specify this parameter, this parameter is left empty by default, which indicates that Logtail collects data from all containers. Regular expression matching is supported. To create a map, specify the name of a container label as the key of the map, and specify the value of the container label as the value of the map.
  • If the value of the map is empty, the containers whose labels contain the key are matched.
  • If the value of the map is not empty, take note of the following information:
    • If the value starts with a caret (^) and ends with a dollar sign ($), the containers that meet the following conditions are matched: The name of a container label contains the key of the map, and the value of the container label matches the regular expression specified by the value of the map.
    • In other cases, the containers whose labels exactly match the key and value of the map are matched.
ContainerFilters.ExcludeContainerLabelmapNoEmpty/The labels.of the containers from which you do not want to collect data. Multiple conditions are evaluated by using a logical OR. If you do not specify this parameter, this parameter is left empty by default, which indicates that Logtail collects data from all containers. Regular expression matching is supported. To create a map, specify the name of a container label as the key of the map, and specify the value of the container label as the value of the map.
  • If the value of the map is empty, the containers whose labels contain the key are matched.
  • If the value of the map is not empty, take note of the following information:
    • If the value starts with a caret (^) and ends with a dollar sign ($), the containers that meet the following conditions are matched: The name of a container label contains the key of the map, and the value of the container label matches the regular expression specified by the value of the map.
    • In other cases, the containers whose labels exactly match the key and value of the map are matched.
ExternalK8sLabelTagmapNoEmpty/The tags that you want to add to the collected logs. The tags are related to the labels of the pods to which the required containers belong. The containers refer to Kubernetes containers from which you want to collect data. To create a map, specify the name of a pod label as the key of the map, and specify the name of the required tag as the value of the map. For example, a map of app: k8s\_label\_app is created. If a pod contains the app=serviceA label, the system adds the related information to the collected logs as a tag. In this example, the __tag__:k8s_label_app: serviceA field is added to the collected logs. If a pod does not contain the app label, the __tag__:k8s_label_app:field is added.
ExternalEnvTagmapNoEmpty/The tags that you want to add to the collected logs. The tags are related to the environment variables of the required containers. The containers refer to Kubernetes containers from which you want to collect data. To create a map, specify the name of an environment variable as the key of the map, and specify the name of the required tag as the value of the map. For example, a map of VERSION: env\_version is created. If a container contains the VERSION=v1.0.0 environment variable, the system adds the related information to the collected logs as a tag. In this example, the __tag__:env_version: v1.0.0 field is added to the collected logs. If a container does not contain the VERSION environment variable, the __tag__:env_version:field is added.
CollectingContainersMetaboolNofalsetrueSpecifies whether to enable the container metadata preview feature.
AppendingLogPositionMetaboolNofalsefalseSpecifies whether to add the metadata of a file to a log. The log is included in the file. The metadata includes the __tag__:__inode__ field and the __file_offset__ field.
AllowingIncludedByMultiConfigsboolNofalsefalseSpecifies whether to allow Logtail to collect data from a file that is matched by a different Logtail configuration.

Plug-in for collecting MySQL data

ParameterTypeRequiredDefault valueExampleDescription
TypestringYes/service_mysqlThe type of the plug-in. Set the value to service_mysql.
AddressstringNo127.0.0.1:3306rm-*.mysql.rds.aliyuncs.comThe address of the MySQL database.
UserstringNorootrootThe username of the account that is used to log on to the MySQL database.
PasswordstringNoEmptyThe password of the account that is used to log on to the MySQL database. If you have high requirements for data security, we recommend that you set the username and password to xxx. After your configuration is synchronized to the Logtail server, find the two parameters in the /usr/local/ilogtail/user_log_config.json file, and change the values based on your business requirements. For more information, see Modify the Logtail configuration on the Logtail server.Note If you modify this parameter in the Simple Log Service console, the parameter setting in the Logtail configuration on the Logtail server is overwritten after the modification is synchronized to the server.
DataBasestringNo/project_databaseThe name of the MySQL database.
DialTimeOutMsintNo50005000The timeout period for connections to the MySQL database. Unit: milliseconds.
ReadTimeOutMsintNo50005000The timeout period for reading query results in the MySQL database. Unit: milliseconds.
StateMentstringNo/The SELECT statement. If you set CheckPoint to true, you must include the column specified by CheckPointColumn in a WHERE clause of the SELECT statement that you specify for StateMent. You can use question marks (?) to indicate replacement characters. If you use a question mark (?) in the SELECT statement, you must also specify CheckPointColumn. For example, if you set CheckPointColumn to id and CheckPointStart to 0, you can set StateMent to SELECT * from ... where id > ?. Each time Logtail executes the SELECT statement, the system saves the ID of the last data record as the checkpoint. The next time Logtail executes the SELECT statement, the question mark (?) specified in the SELECT statement is replaced with the ID that corresponds to the saved checkpoint.
LimitboolNofalsetrueSpecifies whether to use a LIMIT clause to paginate query results. Valid values:
  • true
  • false (default)
We recommend that you use a LIMIT clause to paginate query results. If you set Limit to true, a LIMIT clause is automatically added to the SELECT statement that you specify for StateMent when Logtail executes the SQL statement.
PageSizeintNo/10The number of entries per page. This parameter is required if you set Limit to true.
MaxSyncSizeintNo00The maximum number of logs that can be synchronized at a time. Default value: 0, which indicates that no limits are imposed.
CheckPointboolNofalsetrueSpecifies whether to use checkpoints during data collection. Valid values:
  • true
  • false (default)
A checkpoint can be used as the start point of the next data collection. This way, incremental data is collected.
CheckPointColumnstringNoEmpty1The name of the checkpoint column. This parameter is required if you set CheckPoint to true. Warning Values in the checkpoint column must be incremental. Otherwise, some data may not be collected. The maximum value in the results of a query operation is used as the input for the next query operation.
CheckPointColumnTypestringNoEmptyintThe data type of the checkpoint column. Valid values: int and time. If you set this parameter to int, the values in the checkpoint column are stored as 64-bit integers. If you set this parameter to time, the values in the checkpoint column can be of the date, time, or datetime type that is supported by MySQL. This parameter is required if you set CheckPoint to true.
CheckPointStartstringNoEmptyThe initial value of the checkpoint column. This parameter is required if you set CheckPoint to true.
CheckPointSavePerPageboolNotruetrueSpecifies whether to save checkpoints each time query results are paginated. Valid values:
  • true (default): saves checkpoints each time query results are paginated.
  • false: saves checkpoints each time query results are synchronized.
IntervalMsintNo6000060000The synchronization interval. Unit: milliseconds. Default value: 60000.

Plug-in for collecting HTTP data

ParameterTypeRequiredDefault valueExampleDescription
TypestringYes/metric_httpThe type of the plug-in. Set the value to metric_http.
AddressstringYes/The URLs. Important A URL must start with http or https.
IntervalMsintYes/10The interval between two consecutive requests. Unit: milliseconds.
MethodstringNoGETGETThe request method. You must specify a request method in uppercase letters.
BodystringNoEmptyThe body of the HTTP request.
HeadersmapNoEmpty{"key":"value"}The headers of the HTTP request. Example: {"key":"value"}. You can specify this parameter based on your business requirements.
PerAddressSleepMsintNo100100The interval at which requests are sent to the URLs specified by Addresses. Unit: milliseconds.
ResponseTimeoutMsintNo50005000The timeout period for a request. Unit: milliseconds.
IncludeBodyboolNofalsetrueSpecifies whether to collect the request body. Default value: false. If you set this parameter to true, the request body is stored in the field that is named content.
FollowRedirectsboolNofalsefalseSpecifies whether to automatically process URL redirects.
InsecureSkipVerifyboolNofalsefalseSpecifies whether to skip the HTTPS security check.
ResponseStringMatchstringNo/Specifies whether to match the response body against a regular expression. The match result is stored in the field that is named _response_match_. If the response body matches the regular expression, the value of the field is yes. Otherwise, the value is no.

Plug-in for collecting syslogs

ParameterTypeRequiredDefault valueExampleDescription
TypestringYes/service_syslogThe type of the plug-in. Set the value to service_syslog.
AddressstringNotcp://127.0.0.1:9999The listener protocol, IP address, and port of Logtail. Logtail listens to log sources and obtains logs based on your Logtail configuration. Specify a value in the [tcp/udp]://[ ip ]:[ port ] format. Default value: tcp://127.0.0.1:9999, which indicates that Logtail receives only logs that are forwarded to the Logtail server. Note
  • The listener protocol, IP address, and port that you specify in your Logtail configuration must be the same as those specified in the forwarding rule that is added to the configuration file of rsyslog.
  • If the server on which Logtail is installed uses multiple IP addresses to receive logs, set Address to 0.0.0.0, which indicates that Logtail listens to all IP addresses of the server.
ParseProtocolstringNoEmptyrfc3164The protocol that you want Logtail to use to parse logs. This parameter is left empty by default, which indicates that logs are not parsed. Valid values:
  • Empty: Logtail does not parse logs.
  • rfc3164: The RFC 3164 protocol is used to parse logs.
  • rfc5424: The RFC 5424 protocol is used to parse logs.
  • auto: Logtail automatically selects a protocol based on the content of logs.
IgnoreParseFailureboolNotruetrueSpecifies whether to perform an operation on a log after the log fails to be parsed. Valid values: true and false. Default value: true, which indicates that the system does not parse the log and adds the log to the content field. If you set this parameter to false, the system discards the log after the log fails to be parsed.

Plug-in for collecting systemd journal logs

ParameterTypeRequiredDefault valueExampleDescription
TypestringYes/service_journalThe type of the plug-in. Set the value to service_journal.
JournalPaths[string]YesEmpty/var/log/journalThe path to the journal logs. We recommend that you set this parameter to the directory of the logs.
SeekPositionstringNotailtailThe method for initial collection. Valid values: head and tail.
  • head: Logtail collects all data.
  • tail: Logtail collects only the data that is generated after your Logtail configuration is applied.
KernelboolNotruetrueSpecifies whether to collect kernel logs.
Units[string]NoEmpty""The units whose logs you want to collect. This parameter is empty by default, which indicates that Logtail collects the logs of all units.
ParseSyslogFacilityboolNofalsefalseSpecifies whether to parse the Facility field of syslogs. If you do not specify this parameter, Logtail does not parse the Facility field.
ParsePriorityboolNofalsefalseSpecifies whether to parse the Priority field. If you do not specify this parameter, Logtail does not parse the Priority field. If you set this parameter to true, Logtail parses the Priority field. The following list describes the mapping relationships for the field: plaintext "0": "emergency" "1": "alert" "2": "critical" "3": "error" "4": "warning" "5": "notice" "6": "informational" "7": "debug"
UseJournalEventTimeboolNofalsefalseSpecifies whether to use a field in journal logs as the log time. If you do not specify this parameter, the system uses the collection time as the log time. In real-time log collection scenarios, the difference between the log generation time and the log collection time is less than 3 seconds.

Plug-in for collecting SQL Server data

ParameterTypeRequiredDefault valueExampleDescription
TypestringYes/service_mssqlThe type of the plug-in. Set the value to service_mssql.
AddressstringNo127.0.0.1:1433rm-*.sqlserver.rds.aliyuncs.comThe address of the SQL Server database.
UserstringNorootrootThe username of the account that is used to log on to the SQL Server database.
PasswordstringNoEmptyThe password of the account that is used to log on to the SQL Server database. If you have high requirements for data security, we recommend that you set the username and password to xxx. After your configuration is synchronized to the Logtail server, find the two parameters in the /usr/local/ilogtail/user_log_config.json file, and change the values based on your business requirements. For more information, see Modify the Logtail configuration on the Logtail server.Note If you modify this parameter in the Simple Log Service console, the parameter setting in the Logtail configuration on the Logtail server is overwritten after the modification is synchronized to the server.
DataBasestringNo/project_databaseThe name of the SQL Server database.
DialTimeOutMsintNo50005000The timeout period for connections to the SQL Server database. Unit: milliseconds.
ReadTimeOutMsintNo50005000The timeout period for reading query results in the SQL Server database. Unit: milliseconds.
StateMentstringNo/The SELECT statement. If you set CheckPoint to true, you must include the column specified by CheckPointColumn in a WHERE clause of the SELECT statement that you specify for StateMent. You can use question marks (?) to indicate replacement characters. If you use a question mark (?) in the SELECT statement, you must also specify CheckPointColumn. For example, if you set CheckPointColumn to id and CheckPointStart to 0, you can set StateMent to SELECT * from ... where id > ?. Each time Logtail executes the SELECT statement, the system saves the ID of the last data record as the checkpoint. The next time Logtail executes the SELECT statement, the question mark (?) specified in the SELECT statement is replaced with the ID that corresponds to the saved checkpoint.
LimitboolNofalsetrueSpecifies whether to use a LIMIT clause to paginate query results. Valid values:
  • true
  • false (default)
We recommend that you use a LIMIT clause to paginate query results. If you set Limit to true, a LIMIT clause is automatically added to the SELECT statement that you specify for StateMent when Logtail executes the SQL statement.
PageSizeintNo/10The number of entries per page. This parameter is required if you set Limit to true.
MaxSyncSizeintNo00The maximum number of logs that can be synchronized at a time. Default value: 0, which indicates that no limits are imposed.
CheckPointboolNofalsetrueSpecifies whether to use checkpoints during data collection. Valid values:
  • true
  • false (default)
A checkpoint can be used as the start point of the next data collection. This way, incremental data is collected.
CheckPointColumnstringNoEmpty1The name of the checkpoint column. This parameter is required if you set CheckPoint to true. Warning Values in the checkpoint column must be incremental. Otherwise, some data may not be collected. The maximum value in the results of a query operation is used as the input for the next query operation.
CheckPointColumnTypestringNoEmptyintThe data type of the checkpoint column. Valid values: int and time. If you set this parameter to int, the values in the checkpoint column are stored as 64-bit integers. If you set this parameter to time, the values in the checkpoint column can be of the date, time, or datetime type that is supported by SQL Server. This parameter is required if you set CheckPoint to true.
CheckPointStartstringNoEmptyThe initial value of the checkpoint column. This parameter is required if you set CheckPoint to true.
CheckPointSavePerPageboolNotruetrueSpecifies whether to save checkpoints each time query results are paginated. Valid values:
  • true (default): saves checkpoints each time query results are paginated.
  • false: saves checkpoints each time query results are synchronized.
IntervalMsintNo6000060000The synchronization interval. Unit: milliseconds. Default value: 60000.

Plug-in for collecting PostgreSQL data

ParameterTypeRequiredDefault valueExampleDescription
TypestringYes/service_pgsqlThe type of the plug-in. Set the value to service_pgsql.
AddressstringNo127.0.0.1:5432rm-*.pg.rds.aliyuncs.comThe address of the PostgreSQL database.
UserstringNorootrootThe username of the account that is used to log on to the PostgreSQL database.
PasswordstringNoEmptyThe password of the account that is used to log on to the PostgreSQL database. If you have high requirements for data security, we recommend that you set the username and password to xxx. After your configuration is synchronized to the Logtail server, find the two parameters in the /usr/local/ilogtail/user_log_config.json file, and change the values based on your business requirements. For more information, see Modify the Logtail configuration on the Logtail server.Note If you modify this parameter in the Simple Log Service console, the parameter setting in the Logtail configuration on the Logtail server is overwritten after the modification is synchronized to the server.
DataBasestringNo/project_databaseThe name of the PostgreSQL database.
DialTimeOutMsintNo50005000The timeout period for connections to the PostgreSQL database. Unit: milliseconds.
ReadTimeOutMsintNo50005000The timeout period for reading query results in the PostgreSQL database. Unit: milliseconds.
StateMentstringNo/The SELECT statement. If you set CheckPoint to true, you must include the column specified by CheckPointColumn in a WHERE clause of the SELECT statement that you specify for StateMent and set the value for the column to $1. For example, if you set CheckPointColumn to id, you can set StateMent to SELECT * from ... where id > $1.
LimitboolNofalsetrueSpecifies whether to use a LIMIT clause to paginate query results. Valid values:
  • true
  • false (default)
We recommend that you use a LIMIT clause to paginate query results. If you set Limit to true, a LIMIT clause is automatically added to the SELECT statement that you specify for StateMent when Logtail executes the SQL statement.
PageSizeintNo/10The number of entries per page. This parameter is required if you set Limit to true.
MaxSyncSizeintNo00The maximum number of logs that can be synchronized at a time. Default value: 0, which indicates that no limits are imposed.
CheckPointboolNofalsetrueSpecifies whether to use checkpoints during data collection. Valid values:
  • true
  • false (default)
A checkpoint can be used as the start point of the next data collection. This way, incremental data is collected.
CheckPointColumnstringNoEmpty1The name of the checkpoint column. This parameter is required if you set CheckPoint to true. Warning Values in the checkpoint column must be incremental. Otherwise, some data may not be collected. The maximum value in the results of a query operation is used as the input for the next query operation.
CheckPointColumnTypestringNoEmptyintThe data type of the checkpoint column. Valid values: int and time. If you set this parameter to int, the values in the checkpoint column are stored as 64-bit integers. If you set this parameter to time, the values in the checkpoint column can be of the time type that is supported by PostgreSQL. This parameter is required if you set CheckPoint to true.
CheckPointStartstringNoEmptyThe initial value of the checkpoint column. This parameter is required if you set CheckPoint to true.
CheckPointSavePerPageboolNotruetrueSpecifies whether to save checkpoints each time query results are paginated. Valid values:
  • true (default): saves checkpoints each time query results are paginated.
  • false: saves checkpoints each time query results are synchronized.
IntervalMsintNo6000060000The synchronization interval. Unit: milliseconds. Default value: 60000.

Plug-in for collecting SNMP protocol data

ParameterTypeRequiredDefault valueExampleDescription
Targets[string]Yes/127.0.0.1The IP address of the machine group.
PortstringNo161161The port for the Simple Network Management Protocol (SNMP) protocol.
CommunitystringNopublicpublicThe name of the community. SNMPv1 and SNMPv2 allow you to use the community name for authentication.
UserNamestringNoEmptyrootThe username. SNMPv3 allows you to use the username for authentication.
AuthenticationProtocolstringNoNoAuthNoAuthThe authentication protocol. SNMPv3 allows you to use the authentication protocol for authentication.
AuthenticationPassphrasestringNoEmptyThe password for the authentication protocol. This parameter is empty by default. This parameter is required if you set AuthenticationProtocol to MD5 or SHA.
PrivacyProtocolstringNoNoPrivNoPrivThe privacy protocol. SNMPv3 allows you to use the privacy protocol for authentication.
PrivacyPassphrasestringNoEmptyThe password for the privacy protocol. By default, the value of this parameter is the same as the password for the authentication protocol. This parameter is required if you set PrivacyProtocol to DES or AES.
TimeoutintNo55The timeout period of the query operation. Unit: seconds.
VersionintNo22The version of the SNMP protocol. Valid values: 1, 2, and 3.
TransportstringNoudpudpThe method of SNMP communication. Valid values: udp and tcp.
MaxRepetitionsintNo00The number of retries allowed after the query operation times out.
Oids[string]NoEmpty1The object identifier that is obtained from the required server.
Fields[string]NoEmptyintThe fields that you want to query on the required server. The plug-in looks up the local management information base, translates the fields into object identifiers, and then uses the object identifiers to perform the query operation.
Tables[string]NoEmptyThe tables that you want to query on the required server. The plug-in queries all the fields in the tables, looks up the local management information base, translates the fields into object identifiers, and then uses the object identifiers to perform the query operation.

Plug-in for collecting script execution logs

ParameterTypeRequiredDefault valueExampleDescription
TypestringYes/input_commandThe type of the plug-in. Set the value to input_command.
ScriptTypestringYesEmptyshellThe type of the script. Valid values: bash, shell, python2, and python3.
UserstringYes/publicThe name of the user that is used to execute the script. Only non-root users are supported. Note Make sure that the specified user name exists on the server. We recommend that you grant the user only the rwx permissions on the required directories or files.
ScriptContentstringYesEmptyThe content of the script. The content can be Base64-encoded or plaintext. The content must be no more than 524,288 bytes in length.
ContentEncodingstringNoPlainTextPlainTextThe text format of the script content. Valid values:
  • PlainText (default)
  • Base64
LineSplitSepstringNoEmptyThe delimiter that is used to separate the output of the script. If you leave this parameter empty, the output of the script is returned as a single data record.
CmdPathstringNoEmpty/usr/bin/bashThe execution path of the script. If you leave this parameter empty, the default path is used. Default paths:
  • bash: /usr/bin/bash
  • shell: /usr/bin/sh
  • python2: /usr/bin/python2
  • python3: /usr/bin/python3
TimeoutMilliSecondsintNo30003000The timeout period for script execution. Unit: milliseconds.
IgnoreErrorboolNofalsefalseSpecifies whether to ignore error logs that are generated when Logtail fails to execute the script. Default value: false.
Environments[string]NoThe environment variable. By default, the value returned by the os.Environ() function is used. If you specify this parameter, the value of this parameter is appended to the value returned by the os.Environ() function.
IntervalMsintNo50005000The intervals at which logs are collected or the script is executed. Unit: milliseconds.

Processing plug-ins

Native plug-ins for data processing

Data Parsing (Regex Mode) plug-in

ParameterTypeRequiredDefault valueExampleDescription
TypestringYes/processor_parse_regex_nativeThe type of the plug-in. Set the value to processor_parse_regex_native.
SourceKeystringYes/contentThe name of the original field.
RegexstringYes/(\d+-\d+-\d+)\s+(.*)The regular expression.
Keys[string]Yes/["time", "msg"]The fields that you want to extract.
KeepingSourceWhenParseFailboolNofalsefalseSpecifies whether to retain the original field if the parsing fails.
KeepingSourceWhenParseSucceedboolNofalsefalseSpecifies whether to retain the original field if the parsing succeeds.
RenamedSourceKeystringNoEmptykeyThe name of the field that is used to store the original field when the original field is retained. If you do not specify this parameter, the name of the original field is used.

Data Parsing (JSON Mode) plug-in

ParameterTypeRequiredDefault valueExampleDescription
TypestringYes/processor_parse_json_nativeThe type of the plug-in. Set the value to processor_parse_json_native.
SourceKeystringYes/contentThe name of the original field.
KeepingSourceWhenParseFailboolNofalsefalseSpecifies whether to retain the original field if the parsing fails.
KeepingSourceWhenParseSucceedboolNofalsefalseSpecifies whether to retain the original field if the parsing succeeds.
RenamedSourceKeystringNoEmptykeyThe name of the field that is used to store the original field when the original field is retained. If you do not specify this parameter, the name of the original field is used.

Data Parsing (Delimiter Mode) plug-in

ParameterTypeRequiredDefault valueExampleDescription
TypestringYes/processor_parse_delimiter_nativeThe type of the plug-in. Set the value to processor_parse_delimiter_native.
SourceKeystringYes/contentThe name of the original field.
SeparatorstringYes/,The delimiter.
QuotestringNo""The quote.
Keys[string]Yes/["time", "msg"]The fields that you want to extract.
AllowingShortenedFieldsboolNotruetrueSpecifies whether to upload logs whose extracted fields are less than the fields specified in Keys. If you set this parameter to false, the system considers that the parsing fails.
OverflowedFieldsTreatmentstringNoextendextendThe method that is used to process logs whose extracted fields are greater than the fields specified in Keys. Valid values:
  • extend: retains excess fields and adds each excess field as a separate field to the collected log in the column$i format, where $i represents the sequence number of an excess field. The sequence number starts from 0.
  • keep: retains excess fields and adds the excess fields as a whole field to the collected log in the column0_ format.
  • discard: discards excess fields.
KeepingSourceWhenParseFailboolNofalsefalseSpecifies whether to retain the original field if the parsing fails.
KeepingSourceWhenParseSucceedboolNofalsefalseSpecifies whether to retain the original field if the parsing succeeds.
RenamedSourceKeystringNoEmptykeyThe name of the field that is used to store the original field when the original field is retained. If you do not specify this parameter, the name of the original field is used.

Data Parsing (Apache Mode) plug-in

ParameterTypeRequiredDefault valueExampleDescription
TypestringYes/processor_parse_apsara_nativeThe type of the plug-in. Set the value to processor_parse_apsara_native.
SourceKeystringYes/contentThe name of the original field.
TimezonestringNoEmptyGMT+08:00The time zone of the log time. Format: GMT+HH:MM or GMT-HH:MM.
KeepingSourceWhenParseFailboolNofalsefalseSpecifies whether to retain the original field if the parsing fails.
KeepingSourceWhenParseSucceedboolNofalsefalseSpecifies whether to retain the original field if the parsing succeeds.
RenamedSourceKeystringNoEmptykeyThe name of the field that is used to store the original field when the original field is retained. If you do not specify this parameter, the name of the original field is used.

Time Parsing plug-in

ParameterTypeRequiredDefault valueExampleDescription
TypestringYes/processor_parse_timestamp_nativeThe type of the plug-in. Set the value to processor_parse_timestamp_native.
SourceKeystringYes/contentThe name of the original field.
SourceFormatstringYes/%Y/%m/%d %H:%M:%SThe format of the log time. For more information, see Time formats.
SourceTimezonestringNoEmptyGMT+08:00The time zone of the log time. Format: GMT+HH:MM or GMT-HH:MM.

Data Filtering plug-in

ParameterTypeRequiredExampleDefault valueDescription
TypestringYesprocessor_filter_regex_native/The type of the plug-in. Set the value to processor_filter_regex_native.
IncludemapYes//The whitelist of log fields. To create a map, specify the name of a field as the key of the map, and specify a regular expression as the value of the map. The regular expression specifies the conditions that are used to match the content of the field. A log is collected only if the field in the log matches the conditions. Multiple conditions are evaluated by using a logical AND. A log is collected only if all conditions are met.

Data Masking plug-in

ParameterTypeRequiredDefault valueExampleDescription
TypestringYes/processor_desensitize_nativeThe type of the plug-in. Set the value to processor_desensitize_native.
SourceKeystringYes/contentThe name of the original field.
MethodstringYes/constThe method that is used to mask sensitive content. Valid values: const and md5. If you set this parameter to const, the system replaces the sensitive content with constants. If you set this parameter to md5, the system replaces the sensitive content with the MD5 value of the sensitive content.
ReplacingStringstringNo (This parameter is required if you set Method to const.)/******The constant string that is used to replace the sensitive content.
ContentPatternBeforeReplacedStringstringYes/'password:'The regular expression that is used to match the prefix of the sensitive content.
ReplacedContentPatternstringYes/[^']*The regular expression that is used to match the sensitive content.
ReplacingAllboolNotruetrueSpecifies whether to replace all sensitive content that is matched.

Output plug-in

Simple Log Service output plug-in

ParameterTypeRequiredDefault valueExampleDescription
TypestringYes/flusher_slsThe type of the plug-in. Set the value to flusher_sls.
LogstorestirngYes/test-logstoreThe name of the Logstore.

Response parameters

ParameterTypeDescriptionExample
headersobject
Serverstring

The name of the server.

nginx
Content-Typestring

The content type of the response body.

application/json
Content-Lengthstring

The content length of the response body.

0
Connectionstring

Indicates whether the connection is persistent. Valid values: close and keep-alive. close: The connection is non-persistent. A new TCP connection is established for each HTTP request. keep-alive: The connection is persistent. After a TCP connection is established, the connection remains open, and no more time or bandwidth is consumed to establish new connections.

close
Datestring

The time when the response was returned.

Sun, 27 May 2018 08:25:04 GMT
x-log-requestidstring

The request ID.

5B0A6B60BB6EE39764D458B5

Examples

Sample success responses

JSONformat

{}

Error codes

For a list of error codes, visit the Service error codes.