Logtail configuration

Last Updated: Apr 12, 2018

By default, you can create at most 100 Logtail configurations for a project. The configuration name must be unique in the same project.

You can use the configuration to specify the location, method, and parameters for log collection.

The configuration naming rules are as follows:

  • The name can only contain lowercase letters, numbers, hyphens (-), and underscores (_).
  • The name must begin and end with a lowercase letter or number.
  • The name must be 2–128 bytes long.

Example of the complete resource:

  1. {
  2. "configName": "testcategory1",
  3. inputType”: file”,
  4. "inputDetail": {
  5. logType”: common_reg_log”,
  6. logPath”: “/var/log/httpd/”,
  7. filePattern”: access.log”,
  8. localStorage”: true,
  9. timeFormat”: “%Y/%m/%d %H:%M:%S”,
  10. logBeginRegex”: “.*”,
  11. regex”: “(\w+)(\s+)”,
  12. key :[“key1”, key2”],
  13. filterKey”:[“key1”],
  14. filterRegex”:[“regex1”],
  15. topicFormat”: none
  16. },
  17. outputType”: sls”,
  18. outputDetail”:
  19. {
  20. logstoreName”: perfcounter
  21. },
  22. createTime": 1400123456,
  23. “lastModifyTime": 1400123456
  24. }
Attribute name Type Required Description
configName string Yes The Logtail configuration name, which is unique in the same project.
inputType string Yes The input type. Currently, only file is supported.
inputDetail json Yes See the descriptions in the following table.
outputType string Yes The output type. Currently, only LogService is supported.
outputDetail string Yes See the descriptions in the following table.
createTime(output-only) integer No The created time of the configuration.
lastModifyTime(output-only) integer No The time when the resource is updated in Log Service.

inputDetail contents

Attribute name Type Required Description
logType string Yes The log type. Currently, only common_reg_log is supported.
logPath string Yes The parent directory where the log resides. For example, /var/logs/.
filePattern string Yes The pattern of a log file. For example, access*.log.
localStorage boolean Yes Whether or not to activate the local cache. Logs of 1 GB can be cached locally when the link to Log Service is disconnected.
timeFormat string Yes The format of log time. For example, %Y/%m/%d %H:%M:%S.
logBeginRegex string Yes The characteristics (regular expression) of the first log line, which is used to match with logs composed of multiple lines.
regex string Yes The regular expression used for extracting logs.
key array Yes The key generated after logs are extracted.
filterKey array Yes The key used for filtering logs. The log meets the requirements only when the key value matches the regular expression specified in the corresponding filterRegex column.
filterRegex array Yes The regular expression corresponding to each filterKey. The length of filterRegex must be the same as that of filterKey.
topicFormat string No Use a part of the log file path as the topic. For example, /var/log/(.*).log. The default value is none, which indicates the topic is empty.
preserve boolean No true indicates that the monitored directory never times out. false indicates that the timeout for monitored directory is 30 minutes. The default value is true.
preserveDepth integer No If preserve is set to false, specify the depth of the directories with no monitoring timeout. The maximum depth is 3.

outputDetail content

Attribute name Type Required Description
logstoreName string Yes The Logstore name.
Thank you! We've received your feedback.