sonar-log-schema-fields
Retrieves the list of fields defined in the specified log schema. You can check each field's name, display name, type, and display order.
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
schema=STR(required)- The log schema code to query fields for
locale=STR- The locale to get the display name from. Specify one of
ko,en,ja, orzh. If not specified, uses the locale configured for the session.
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 |
|---|---|---|
| name | string | Field name |
| display_name | string | Field display name (the display name for the specified language when the locale option is applied) |
| type | string | Field type (for example, IP, STRING, DATE) |
| ordinal | integer | Display order |
Error codes
Parsing errors
| Error code | Message | Description |
|---|---|---|
| 300146 | No permission to enumerate log schemas. | Run by an account without administrator permission |
| 300147 | Schema option is required. | The schema option was not specified |
Runtime errors
| Error code | Message | Description | Post-action |
|---|---|---|---|
| - | Schema not found: [schema] | No log schema exists for the schema option value | Aborts query execution |
Description
The sonar-log-schema-fields command retrieves the fields defined in the log schema specified by the schema option and returns the field name, display name, type, and display order (ordinal). If the schema has no fields defined, it finishes with no results.
If you specify the locale option, the display_name field value is replaced with the display name for that language. If you specify an unsupported locale value, it is ignored and the default display name is returned; even for a supported locale, if there is no translation for that language, the default display name is used instead. If the locale option is not specified, the current session's locale setting is followed.
Examples
-
Query the field list of a schema
sonar-log-schema-fields schema="session" -
Query display names in English
sonar-log-schema-fields schema="session" locale="en" -
Query only field names in display order
sonar-log-schema-fields schema="session" | sort ordinal | fields name, display_name
Change history
The sonar-log-schema-fields 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.