A log with full text in a single line means a line is a full log. When CLS collects logs, it uses
\n as line break to end a log with. For structural purposes, each log contains a default key value
__CONTENT__, but the log data itself will not be structured, nor will any log fields be extracted. The log attribute
Time is determined by the time the log was collected.
Assume a log contains raw data as follows:
Tue Jan 22 12:08:15 CST 2019 Installed: libjpeg-turbo-static-1.2.90-6.el7.x86_64
CLS outputs it into:
__CONTENT__:Tue Jan 22 12:08:15 CST 2019 Installed: libjpeg-turbo-static-1.2.90-6.el7.x86_64
Log in to the CLS Console, and click Logset in the left sidebar.
Select a logset, click Add Log Topic, enter the log topic name, e.g.
test_full, and click OK.
A path under which to collect logs takes the form [directory prefix expression]/**/[file name expression]. LogListener matches all paths with common prefixes that satisfy the [directory prefix expression], and listen on all log files under these directories (including subdirectories) that satisfy the [file name expression]. The detailed parameters are as follows:
|Directory prefix||The prefix of a log directory; supports only the wildcard characters
|/**/||Current directory and all its subdirectories|
|File name||Name of a log file; supports only the wildcard characters
Common configuration patterns include:
- [Common directory prefix]/**/[Common filename prefix]*
- [Common directory prefix]/**/*[Common filename suffix]
- [Common directory prefix]/**/[Common filename prefix]*[Common filename suffix]
- [Common directory prefix]/**/*[Common string]*
|No.||Directory Prefix Expression||Filename Expression||Description|
|1.||/var/log/nginx||access.log||This example configures the log path to
|2.||/var/log/nginx||*.log||This example configures the log path to
|3.||/var/log/nginx||error*||This example configures the log path to
- The configuration of hierarchical directories and wildcards is only available for Loglistener version 2.2.2 or above. In order to be compatible with lower versions, you can modify the old path configuration which does not support hierarchical directories.
- A log file will only be collected by one log topic.
- LogListener cannot listen on log files with symbolic links, or in shared file directories of NFS, CIFS, etc.
Select a server group from the server groups list, and associate it with the log topic. Note that this server group and log topic should be in the same region. For more information, see Creating a Server Group under Server Group Management.
The Filter is designed to help you get useful logs by adding log filtering rules as needed. These rules are Perl regexes that must be matched for logs to be collected.
By default, this Full-text-in-a-single-line mode uses
__CONTENT__ as the key of a log. Assume a sample log is
Tue Jan 22 12:08:15 CST 2019 Installed: libjpeg-turbo-static-1.2.90-6.el7.x86_64, and you want to collect all such logs on Jan 22, then enter
Tue Jan 22.* under Filtering Rule.
The "AND" logic is used for multiple filtering rules; rules will be written if more than one rule is specified for one key.
Log in to the CLS console, and click Log Search in the left sidebar. Select Logset and Log Topic from their drop-down list, and click Search Analysis to begin the search.
A log topic must have index configuration enabled to be searchable.