Configuring the parser with a different JsonMessageDepth

Changing the value set for the JsonMessageDepth property changes the tokens that the parser generates.

The table that follows the example JSON data below illustrates how changing the JsonMessageDepth property in the message_bus.props file determines which key-value pairs the parser generates.


{
	"properties": {
		"storage": {
			"type": "object",
			"oneOf": [
			  	{"$ref": "#/definitions/diskDevice"},
				  {"$ref": "#/definitions/diskUUID"},
			  	{"$ref": "#/definitions/nfs"},
			  	{"$ref": "#/definitions/tmpfs"}
			 ]
		},
		"fstype": {
			"enum": ["ext3", "ext4", "btrfs"]
		},
		"options": {
			"type": "array",
			"minItems": 1,
			"items": {
				"type": "string"
			},
			"uniqueItems": true
		}
	}
}
Table 1. Tokens genarated
JSON parser properties Tokens generated
MessagePayload    = “json.properties”
JsonMessageDepth  = 1
MessageHeader     = “”
JsonNestedPayload = “”
JsonNestedHeader  = “”

None. There is no field or key-value pair in the first level.

MessagePayload    = “json.properties”
JsonMessageDepth  = 2
MessageHeader     = “”
JsonNestedPayload = “”
JsonNestedHeader  = “”
options.minItems=1
options.type=array
options.uniqueItems=true
resync_event=false
storage.type=object
MessagePayload    = “json.properties”
JsonMessageDepth  = 3 (the default)
MessageHeader     = “”
JsonNestedPayload = “”
JsonNestedHeader  = “”
fstype.enum=ext3,ext4,btrfs
options.items.type=string
options.minItems=1
options.type=array
options.uniqueItems=true
resync_event=false
storage.type=object
Note: Array values such as the enum object are treated as fields or key-value pairs at the same level as the node. With this configuration, the oneOf array of objects is not generated because it is one level deeper.
MessagePayload    = “json.properties”
JsonMessageDepth  = 4
MessageHeader     = “”
JsonNestedPayload = “”
JsonNestedHeader  = “”
fstype.enum=ext3,ext4,btrfs
options.items.type=string
options.minItems=1
options.type=array
options.uniqueItems=true
resync_event=false
storage.oneOf.0.$ref=
     #/definitions/diskDevice
storage.oneOf.1.$ref=
     #/definitions/diskUUID
storage.oneOf.2.$ref=
     #/definitions/nfs
storage.oneOf.3.$ref=
     #/definitions/tmpfs
storage.type=object
Note: With this configuration, the oneOf array of objects is generated.
Note: The resync_event token is not part of the JSON message, but is generated by the probe for internal use.