{
    "$schema": "http://json-schema.org/draft-07/schema#",
    "type": "object",
    "additionalProperties": false,
    "required": [ "created_at", "bytes_used", "bytes_max", "log" ],
    "properties": {
	"created_at": {
	    "type": "string",
	    "description": "UNIX timestamp with 9 decimal places, when logging was initialized"
	},
	"bytes_used": {
	    "type": "u32",
	    "description": "The number of bytes used by logging records"
	},
	"bytes_max": {
	    "type": "u32",
	    "description": "The bytes_used values at which records will be trimmed "
	},
	"log": {
	    "type": "array",
	    "items": {
		"type": "object",
		"required": [ "type" ],
		"additionalProperties": true,
		"properties": {
		    "type": {
			"type": "string",
			"enum": [ "SKIPPED", "BROKEN", "UNUSUAL", "INFO", "DEBUG", "IO_IN", "IO_OUT" ]
		    }
		},
		"allOf": [
		    {
			"if": {
			    "additionalProperties": true,
			    "properties": {
				"type": {
				    "enum": [ "SKIPPED" ]
				}
			    }
			},
			"then": {
			    "additionalProperties": false,
			    "required": [ "num_skipped" ],
			    "properties": {
				"type": { },
				"num_skipped": {
				    "type": "u32",
				    "description": "number of unprinted log entries (deleted or below *level* parameter)"
				}
			    }
			}
		    },
		    {
			"if": {
			    "additionalProperties": true,
			    "properties": {
				"type": {
				    "enum": [ "BROKEN", "UNUSUAL", "INFO", "DEBUG" ]
				}
			    }
			},
			"then": {
			    "additionalProperties": false,
			    "required": [ "time", "source", "log" ],
			    "properties": {
				"type": { },
				"time": {
				    "type": "string",
				    "description": "UNIX timestamp with 9 decimal places after **created_at**"
				},
				"source": {
				    "type": "string",
				    "description": "The particular logbook this was found in"
				},
				"log": {
				    "type": "string",
				    "description": "The actual log message"
				},
				"node_id": {
				    "type": "pubkey",
				    "description": "The peer this is associated with"
				}
			    }
			}
		    },
		    {
			"if": {
			    "additionalProperties": true,
			    "properties": {
				"type": {
				    "enum": [ "IO_IN", "IO_OUT" ]
				}
			    }
			},
			"then": {
			    "additionalProperties": false,
			    "required": [ "time", "source", "log", "data" ],
			    "properties": {
				"type": { },
				"time": {
				    "type": "string",
				    "description": "Seconds after **created_at**, with 9 decimal places"
				},
				"source": {
				    "type": "string",
				    "description": "The particular logbook this was found in"
				},
				"log": {
				    "type": "string",
				    "description": "The associated log message"
				},
				"node_id": {
				    "type": "pubkey",
				    "description": "The peer this is associated with"
				},
				"data": {
				    "type": "hex",
				    "description": "The IO which occurred"
				}
			    }
			}
		    }
		]
	    }
	}
    }
}
