Topic generation modes
- Null - Do not generate topic
The default log topic generation mode is Null - Do not generate topic when you configure Logtail to collect text logs in the console, that is, the topic is a null string, and you can query logs without entering a topic.
- Machine Group Topic Attributes
Machine Group Topic Attributes mode is used to clearly differentiate log data generated in different servers. If the log data of different servers are stored in the same file path and file name, you can divide the machines into different machine groups to distinguish the log data of different servers by topic. To do this, set different topic attributes for different machine groups when creating machine groups, and set the Topic Generation Mode to Machine Group Topic Attributes. Apply the previously created Logtail configuration to those machine groups to complete the configuration.
With this mode selected, Logtail uploads the topic attribute of the machine group where the current machine belongs as the topic name to Log Service when reporting data. When querying logs by using the log index analysis function, you must specify a topic, that is, you must specify the topic attribute of the target machine group as the query condition.
- File Path Regular
This mode is used to differentiate log data generated by users and instances. If service logs are stored under different directories based on users or instances but their subdirectories and log file names are the same, Log Service cannot clearly differentiate which user or instance generates the logs when collecting log files. In this case, you can set the Topic Generation Mode to File Path Regular, enter a regular expression of file paths, and set the topic as the instance name.
With this mode selected, Logtail uploads the instance name as the topic name to Log Service when reporting data. Different topics are generated according to your directory structure and configuration. You must specify the topic name as the instance name when querying logs by using the log index analysis function.
Set log topic
- Configure Logtail in the console by following the Collect text logs.
To set the topic generation mode to Machine Group Topic Attributes, configure the Machine Group Topic when creating/modifying a machine group.
- Expand Advanced Options in the data import wizard and select a topic generation mode from the Topic Generation Mode drop-down list.
Modify log topic
To change the log topic generation mode, modify the Topic Generation Mode option directly in the data import wizard.