Skip to content

Instantly share code, notes, and snippets.

@yangchenyun
Last active November 18, 2021 01:26
Show Gist options
  • Save yangchenyun/494cb040eafdae073cdffba1a93636b9 to your computer and use it in GitHub Desktop.
Save yangchenyun/494cb040eafdae073cdffba1a93636b9 to your computer and use it in GitHub Desktop.
Logging Schema
{
"title": "Logging Schema",
"description": "Describe all the fields which would be indexed by the logging infrastructure.",
"required": [
"level",
"name",
"hostname",
"env",
"time",
"msg"
],
"type": "object",
"properties": {
"level": {
"type": "string",
"description": "logging level"
},
"name": {
"type": "string",
"description": "app name"
},
"hostname": {
"type": "string",
"description": "host name"
},
"time": {
"type": "string",
"description": "RFC 3339 formated logging create time"
},
"msg": {
"type": "string",
"description": "message to log"
},
"err": {
"type": "string",
"description": "err to log"
},
"module": {
"type": "string",
"description": "software module/component/package name"
},
"caller": {
"type": "string",
"description": "code line and file of this log"
},
"trace_id": {
"type": "string",
"description": "websocket/http trace id"
},
"device_sn": {
"type": "string",
"description": "3rd vender device serial number (SN)"
},
"device_type": {
"type": "string",
"description": "3rd vendor device type",
"enum": [
"NVR",
"IPC"
]
},
"device_ip": {
"type": "string",
"description": "3rd vendor device ip"
},
"method": {
"type": "string",
"description": "http method GET/PUT/POST/DELETE ..., and should be upper case",
"enum": [
"GET",
"POST",
"PUT",
"PATCH",
"DELETE",
"COPY",
"HEAD",
"OPTIONS",
"LINK",
"UNLINK",
"PURGE",
"LOCK",
"UNLOCK",
"PROPFIND",
"VIEW"
]
},
"url": {
"type": "string",
"description": "http request/response URL"
},
"status_code": {
"type": "integer",
"description": "http response status code"
},
"task_id": {
"type": "string",
"description": "streaming task id"
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment