Indexes¶
By extracting key features such as log fields and metric tags, indexes can associate feature values with raw data, enabling efficient retrieval and avoiding inefficient full-table scans.
After creating and managing multiple indexes, the system will automatically archive log data into the corresponding indexes based on preset filtering conditions. At the same time, you can customize the data storage strategy for each index, effectively controlling and reducing storage costs while balancing data management flexibility and economic benefits.
Create¶
TrueWatch supports creating or binding three types of indexes:
Index Type |
Definition | Core Features & Data Flow |
Control Ownership |
|---|---|---|---|
| Log Indexes | The basic log storage unit in TrueWatch. After log data is reported, the system automatically sorts and stores it into the matching index based on preset rules (e.g., matching conditions, filters). | Automated sorting by rules Collector → TrueWatch Unified Reception → Sorted by Rules → Written to Target Index |
TrueWatch Console (Controlled by configuring index rules) |
| Native Direct Indexes | A write method where the collector directly specifies the target index name. Data bypasses the platform's default sorting rules and is written directly to the specified index. | Direct write to specified target Collector (specified index name) → Directly written to target index |
Collector Configuration (Specified in DataKit or other collector configurations) |
| External Indexes | A cross-data-source query integration feature provided by TrueWatch. By binding authorization, an external data source (e.g., self-built ES) is mapped as a logical index that can be queried uniformly within the workspace. | External data source binding and unified query Data stored externally, TrueWatch establishes a query channel for retrieval |
External Data Source System (Data ownership and storage management are external) |
When data is collected into TrueWatch, the system splits and distributes it to indexes or forwards it to other third-party systems based on rules, thereby improving data processing efficiency and meeting the need for multi-path data distribution.
Manage Indexes¶
You can manage the index list through the following operations.
Export Indexes¶
In the corresponding index type list, click the "Export" button in the upper right corner to export the corresponding index JSON file.
Import Indexes¶
Supports importing local index configuration files.
Log Index Mapping¶
Log index mapping is used to automatically select the default log index used for related queries on the detail page based on the field value in the detail data.
Note
Log index mapping only affects the related log query on the detail page, and does not affect the matching conditions for log writing to the index.
Configuration Entry¶
Go to Logs > Indexes, click Log Index Mapping, and then create and manage the mapping relationship between field values and default log indexes.
Configuration Method¶
Each mapping contains:
- Match Field: The field name in the detail data, e.g.,
app_id,source,service,env, orversion; - Field Value: The field value used to determine whether to match;
- Default Log Index: The log index to query when the field value matches.
Configuration example:
| Match Field | Field Value | Default Log Index |
|---|---|---|
app_id |
KKHome |
com_kkhome_kksecurity |
source |
df_rum_ios_log |
ios-security-log |
service |
front-backend |
sm-test-front-backend |
To configure the original "Match Service" capability, set the match field to service, then fill in the service name and the corresponding log index.
Related Query¶
After the configuration takes effect, when viewing related logs from data detail pages such as RUM or APM, the system will read the fields in the current detail data and automatically select all matched available log indexes.
The log count statistics and log list query use the same index matching results to ensure consistency between the count and the list content.
Field Value Matching¶
Field values support the following configuration methods:
- Exact match: e.g.,
front-backend; - Multi-value match: multiple values separated by English commas, e.g.,
api,web; - Wildcard match:
*: matches zero or more arbitrary characters;?: matches one arbitrary character.
Multiple Rule Hits¶
The system will check all mapping rules and merge all matched available log indexes:
- When the same field value hits multiple mappings, query all corresponding indexes;
- When exact rules and wildcard rules are hit simultaneously, merge all corresponding indexes;
- When multiple rules point to the same index, the system automatically deduplicates;
- Log count statistics and log list query use the same index set.
For example:
| Match Field | Field Value | Default Log Index |
|---|---|---|
service |
api-* |
application-log |
service |
api-order |
order-log |
When the current service is api-order, the system will query both application-log and order-log.
Index Status Control¶
- Disable index: subsequent logs will no longer enter this index, and will continue to match and flow into other indexes for storage. If no other index matches, they will be stored in the default
defaultindex; - Enable index: subsequent logs will re-enter this index for storage.
Index Configuration Editing¶
Supports editing the configuration of created log indexes.
Note
Changing the storage strategy will delete data in the index, please proceed with caution.
Index Deletion¶
Click the delete icon to delete a created index.
Note
- After deletion, the log data in the index will also be deleted. If no other matching index exists, subsequently reported log data will be stored in the default index
default; - If the deleted index has been authorized for query by other workspaces, those workspaces will no longer be able to query this index after deletion;
- After deleting a log index, you can create an index with the same name as needed.
Index Sorting¶
Click the edit mode: you can drag up and down to adjust the order of created log indexes; supports single select, multi-select across pages to adjust sorting, and can move one or more indexes to a specified position.
Note
Logs will flow into the first matching index. Changing the index order may cause logs to change their flow direction.
Operation Audit¶
Click the audit icon to view all operation logs related to this index.
