sonar-logger-models
Retrieves the list of logger models registered in Logpresso Sonar. A logger model is a collection configuration template that bundles a collector factory, a parser, and normalization rules (log schema extractors).
Command properties
| Property | Description |
|---|---|
| Command type | Driver query |
| Required permission | Administrator |
| License usage | Counted |
| Parallel execution | Not supported |
| Distributed execution | Runs on Data Node (mapper) |
Syntax
Options
keywords=STR- A search keyword for the logger model name
Input fields
None (as a driver query, this command can only be used as the first command in a pipeline)
Output fields
| Field | Type | Description |
|---|---|---|
| guid | string | Logger model GUID |
| name | string | Logger model name |
| description | string | Logger model description |
| logger_factory_name | string | Collector factory identifier |
| logger_factory_display_name | string | Collector factory display name |
| parser_code | string | Parser identifier |
| parser_name | string | Parser name |
| overlay | boolean | Whether overlay is configured. true if not specified when the model was created |
| log_schemas | array | List of log schema codes linked to normalization rules (extractors) |
| app_code | string | App identifier |
| app_built_in | boolean | Whether the logger model object is included in an app |
| rule_count | integer | Number of normalization rules |
| created | timestamp | Creation time |
| updated | timestamp | Last update time |
A logger model with one or more normalization rules also returns the common_stream_query (string, the common stream query) and rules (array, the detailed list of normalization rules) fields in addition to the fields above.
Error codes
Parsing errors
| Error code | Message | Description |
|---|---|---|
| 300145 | No permission to enumerate logger models. | Run by an account without administrator permission |
Runtime errors
N/A
Description
The sonar-logger-models command retrieves and sequentially returns all registered logger models in pages of up to 1,000 records at a time. If you specify the keywords option, it searches the logger model name.
Each logger model looks up its normalization rules (extractors) again to build the log_schemas field. When the rules field is included, any item within a normalization rule whose value is null is not included in the result (the rule itself is not removed).
Examples
-
Retrieve the full list of logger models
sonar-logger-models -
Search by name
sonar-logger-models keywords="apache"Returns only logger models whose name contains
apache. -
Query only logger models included in an app
sonar-logger-models | search app_built_in == true -
Sort by the number of normalization rules
sonar-logger-models | sort -rule_count
Change history
The sonar-logger-models command is available in the Sonar 4.0 series starting with 4.0.2609.0, where the command previously provided by the Experimental app was built into Sonar core. On versions without the built-in command, install the Experimental app to use it.