Graylog2 / Graylog2/graylog2-server

Improve GELF spec documentation by adding JSON schema

Open
#19,581 2 comments 1 reaction 1 assignee Claimed by @waab76 View on GitHub
feature triaged
Dominant language
Java
Stars
8.1k
Forks
1.1k
Avg merge
1d 20h
Merged PRs (30d)
217

Description

The [GELF specification documentation](https://go2docs.graylog.org/5-2/getting_in_log_data/gelf.html?Highlight=gelf) probably should include JSON Schema now that they are becoming more commonly used. It would be useful especially for developers of custom logging for automated testing in CI/CD pipelines.

Here's a basic reference schema for GELF 1.1:
```
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://graylog.com/graylog.gelf.11.json",
"title": "Graylog Extended Log Format",
"description": "The Graylog Extended Log Format (GELF) is a log format that avoids the shortcomings of classic plain syslog",
"type": "object",
"properties": {
"version": {
"description": "GELF spec version",
"const": "1.1"
},
"host": {
"description": "The name of the host, source or application that sent this message",
"type": "string"
},
"short_message": {
"description": "A short, descriptive message",
"type": "string"
},
"full_message": {
"description": "A long message that can contain a backtrace",
"type": "string"
},
"timestamp": {
"description": "Seconds since UNIX epoch with optional decimal places for millisecond",
"type": "number"
},
"level": {
"description": "The level equal to the standard syslog levels",
"type": "number"
},
"facility": {
"description": "Deprecated, send as additional field instead",
"type": "string"
},
"line": {
"description": "Deprecated, the line in a file that caused the error, send as additional field instead",
"type": "string"
},
"file": {
"description": "Depreated, the file that caused the error, send as additional field instead"
}
},
"required": [
"version",
"host",
"short_message"
],
"patternProperties": {
"^_[\\w\\.\\-]*$": {
"description": "Every field you send and prefix with an underscore (_) will be treated as an additional field",
"anyOf": [
{
"type": "string"
},
{
"type": "number"
}
]
},
"^_id$": {
"description": "Additional field _id is reserved for Graylog internal use",
"not": {}
}
},
"additionalProperties": false
}
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.