logtail configuration

Last Updated: Mar 31, 2017

Config is the configuration of logtail. By default, you can create up to 100 configs for each project. A config name must be unique in a project.

You can use config to specify the location, method, and parameters for collecting the logs.

Config naming rules:

  • A config name can only contain lower-case letters, numbers, hyphens (-), and underlines (_).
  • A config name must start and end with a lower-case letter or number.
  • The length must be 2–128 bytes.

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 or Not Description
configName string Yes The log config name, which is unique in the project.
inputType string Yes The input type, which is “file” by default.
inputDetail json Yes See description in the following table.
outputType string Yes The output type. Currently, only LogService is supported.
outputDetail string Yes See description in the following table.
createTime(output-only) integer No The creation time of config.
lastModifyTime(output-only) integer No The update time of this resource on the server.

Content of inputDetail:

Attribute Name Type Required or Not Description
logType string Yes The log type. Currently, only common_reg_log is supported.
logPath string Yes The parent directory where the log is located, for example, /var/logs/.
filePattern string Yes The pattern of the log file, for example, access*.log.
localStorage boolean Yes Whether to activate local cache. Logs of 1 GB can be stored locally when the links across the servers are 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, used in the case of a log composed of multiple lines.
regex string Yes The regular expression used for extracting a log pair.
key array Yes The key generated after the log is extracted.
filterKey array Yes The key used for filtering the log. The log meets 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 same as that of filterKey.
topicFormat string No This is used to take one part of a log file path as a topic, for example, /var/log/(.*).log. The default value is none, indicating that the topic is null.
preserve boolean No “true” indicates that the monitored directories will never be timed out and “false” indicates that the monitored directories have been timed out by 30 minutes. The default value is true.
preserveDepth integer No If preserve is set to false, the depth of the directories with no monitoring timeout is specified. The maximum depth is 3.

Content of outputDetail:

Attribute Name Type Required or Not Description
logstoreName string Yes Name of the LogStore.
Thank you! We've received your feedback.