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

PropertyDescription
Command typeDriver query
Required permissionAdministrator
License usageCounted
Parallel executionNot supported
Distributed executionRuns on Data Node (mapper)

Syntax

sonar-logger-models [keywords=STR]

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

FieldTypeDescription
guidstringLogger model GUID
namestringLogger model name
descriptionstringLogger model description
logger_factory_namestringCollector factory identifier
logger_factory_display_namestringCollector factory display name
parser_codestringParser identifier
parser_namestringParser name
overlaybooleanWhether overlay is configured. true if not specified when the model was created
log_schemasarrayList of log schema codes linked to normalization rules (extractors)
app_codestringApp identifier
app_built_inbooleanWhether the logger model object is included in an app
rule_countintegerNumber of normalization rules
createdtimestampCreation time
updatedtimestampLast 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 codeMessageDescription
300145No 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

  1. Retrieve the full list of logger models

    sonar-logger-models
    
  2. Search by name

    sonar-logger-models keywords="apache"
    

    Returns only logger models whose name contains apache.

  3. Query only logger models included in an app

    sonar-logger-models
    | search app_built_in == true
    
  4. 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.