netdata/netdata

View on GitHub
src/go/collectors/go.d.plugin/modules/weblog/config_schema.json

Summary

Maintainability
Test Coverage
{
  "jsonSchema": {
    "$schema": "http://json-schema.org/draft-07/schema#",
    "type": "object",
    "properties": {
      "update_every": {
        "title": "Update every",
        "description": "Data collection interval, measured in seconds.",
        "type": "integer",
        "minimum": 1,
        "default": 1
      },
      "path": {
        "title": "Log file",
        "description": "The file path to the Webserver log file.",
        "type": "string",
        "default": "/var/log/nginx/access.log",
        "pattern": "^$|^/"
      },
      "exclude_path": {
        "title": "Exclude path",
        "description": "Pattern to exclude log files.",
        "type": "string",
        "default": "*.gz"
      },
      "histogram": {
        "title": "Request processing time histogram",
        "description": "Buckets for the histogram in milliseconds.",
        "type": [
          "array",
          "null"
        ],
        "items": {
          "title": "Bucket",
          "type": "number",
          "exclusiveMinimum": 0
        },
        "uniqueItems": true
      },
      "log_type": {
        "title": "Log parser",
        "description": "Type of parser to use for parsing log files.",
        "type": "string",
        "enum": [
          "auto",
          "csv",
          "regexp",
          "json",
          "ltsv"
        ],
        "default": "auto"
      },
      "url_patterns": {
        "title": "URL patterns",
        "description": "Patterns used to match against the full original request URI. For each pattern, the web log will collect responses by status code, method, bandwidth, and processing time.",
        "type": [
          "array",
          "null"
        ],
        "items": {
          "title": "Patterns",
          "type": [
            "object",
            "null"
          ],
          "properties": {
            "name": {
              "title": "Dimension",
              "description": "A unique name used as a dimension name for the pattern.",
              "type": "string"
            },
            "match": {
              "title": "Pattern",
              "description": "The [pattern string](https://github.com/netdata/netdata/tree/master/src/go/collectors/go.d.plugin/pkg/matcher#readme) used to match against the full original request URI.",
              "type": "string"
            }
          },
          "required": [
            "name",
            "match"
          ]
        },
        "uniqueItems": true
      },
      "custom_fields": {
        "title": "Custom fields",
        "description": "Configuration for custom fields. Fild value expected to be string. Patterns used to match against the value of the specified field. For each pattern, the web log will collect responses by status code.",
        "type": [
          "array",
          "null"
        ],
        "uniqueItems": true,
        "items": {
          "title": "Field configuration",
          "type": [
            "object",
            "null"
          ],
          "properties": {
            "name": {
              "title": "Field name",
              "description": "The name of the custom field.",
              "type": "string"
            },
            "patterns": {
              "title": "Patterns",
              "description": "",
              "type": [
                "array",
                "null"
              ],
              "items": {
                "title": "User patterns",
                "type": [
                  "object",
                  "null"
                ],
                "properties": {
                  "name": {
                    "title": "Dimension",
                    "description": "A unique name used as a dimension name for the pattern.",
                    "type": "string"
                  },
                  "match": {
                    "title": "Pattern",
                    "description": "The [pattern string](https://github.com/netdata/netdata/tree/master/src/go/collectors/go.d.plugin/pkg/matcher#readme) used to match against the field value.",
                    "type": "string"
                  }
                },
                "required": [
                  "name",
                  "match"
                ]
              }
            }
          },
          "required": [
            "name",
            "patterns"
          ]
        }
      },
      "custom_time_fields": {
        "title": "Custom time fields",
        "description": "Configuration for custom time fields. Field value expected to be numeric and represent time. For each field, the web log will calculate the minimum, average, maximum value, and histogram.",
        "type": [
          "array",
          "null"
        ],
        "items": {
          "title": "Field configuration",
          "type": [
            "object",
            "null"
          ],
          "properties": {
            "name": {
              "title": "Field mame",
              "description": "The name of the custom time field.",
              "type": "string"
            },
            "histogram": {
              "title": "Histogram",
              "description": "Buckets for the histogram in milliseconds.",
              "type": [
                "array",
                "null"
              ],
              "uniqueItems": true,
              "items": {
                "title": "Bucket",
                "type": "number",
                "exclusiveMinimum": 0
              },
              "default": [
                0.005,
                0.01,
                0.025,
                0.05,
                0.1,
                0.25,
                0.5,
                1,
                2.5,
                5,
                10
              ]
            }
          },
          "required": [
            "name"
          ]
        }
      },
      "custom_numeric_fields": {
        "title": "Custom numeric field",
        "description": "Configuration for custom numeric fields. Fild value expected to be numeric. For each field, the web log will calculate the minimum, average, maximum value.",
        "type": [
          "array",
          "null"
        ],
        "items": {
          "title": "Field configuration",
          "type": [
            "object",
            "null"
          ],
          "properties": {
            "name": {
              "title": "Name",
              "description": "The name of the custom numeric field.",
              "type": "string"
            },
            "units": {
              "title": "Units",
              "description": "The unit label for the vertical axis on charts.",
              "type": "string"
            },
            "multiplier": {
              "title": "Multiplier",
              "description": "A value to multiply the field value.",
              "type": "number",
              "not": {
                "const": 0
              },
              "default": 1
            },
            "divisor": {
              "title": "Divisor",
              "description": "A value to divide the field value.",
              "type": "number",
              "not": {
                "const": 0
              },
              "default": 1
            }
          },
          "required": [
            "name",
            "units",
            "multiplier",
            "divisor"
          ]
        }
      }
    },
    "required": [
      "path",
      "log_type"
    ],
    "additionalProperties": false,
    "patternProperties": {
      "^name$": {}
    },
    "dependencies": {
      "log_type": {
        "oneOf": [
          {
            "properties": {
              "log_type": {
                "const": "auto"
              }
            }
          },
          {
            "properties": {
              "log_type": {
                "const": "csv"
              },
              "csv_config": {
                "title": "CSV parser configuration",
                "type": [
                  "object",
                  "null"
                ],
                "properties": {
                  "format": {
                    "title": "Format",
                    "description": "Log format.",
                    "type": "string",
                    "default": "$remote_addr - - [$time_local] \"$request\" $status $body_bytes_sent"
                  },
                  "delimiter": {
                    "title": "Delimiter",
                    "description": "Delimiter used to separate fields in the log file. Default: space (' ').",
                    "type": "string",
                    "default": " "
                  }
                },
                "required": [
                  "format",
                  "delimiter"
                ]
              }
            },
            "required": [
              "csv_config"
            ]
          },
          {
            "properties": {
              "log_type": {
                "const": "regexp"
              },
              "regexp_config": {
                "title": "Regular expression parser configuration",
                "type": [
                  "object",
                  "null"
                ],
                "properties": {
                  "pattern": {
                    "title": "Pattern with named groups",
                    "description": "Regular expression pattern with named groups. Use named groups for known fields.",
                    "type": "string",
                    "default": ""
                  }
                },
                "required": [
                  "pattern"
                ]
              }
            },
            "required": [
              "regexp_config"
            ]
          },
          {
            "properties": {
              "log_type": {
                "const": "json"
              },
              "json_config": {
                "title": "JSON parser configuration",
                "type": [
                  "object",
                  "null"
                ],
                "properties": {
                  "mapping": {
                    "title": "Field mapping",
                    "description": "Dictionary mapping fields in logs to known fields.",
                    "type": [
                      "object",
                      "null"
                    ],
                    "additionalProperties": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          {
            "properties": {
              "log_type": {
                "const": "ltsv"
              },
              "ltsv_config": {
                "title": "LTSV parser configuration",
                "type": [
                  "object",
                  "null"
                ],
                "properties": {
                  "field_delimiter": {
                    "title": "Field delimiter",
                    "description": "Delimiter used to separate fields in LTSV logs. Default: tab ('\\t').",
                    "type": "string",
                    "default": "\t"
                  },
                  "value_delimiter": {
                    "title": "Value delimiter",
                    "description": "Delimiter used to separate label-value pairs in LTSV logs.",
                    "type": "string",
                    "default": ":"
                  },
                  "mapping": {
                    "title": "Field mapping",
                    "description": "Dictionary mapping fields in logs to known fields.",
                    "type": [
                      "object",
                      "null"
                    ],
                    "additionalProperties": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        ]
      }
    }
  },
  "uiSchema": {
    "uiOptions": {
      "fullPage": true
    },
    "log_type": {
      "ui:widget": "radio",
      "ui:options": {
        "inline": true
      }
    },
    "custom_fields": {
      "ui:collapsible": true
    },
    "custom_time_fields": {
      "ui:collapsible": true
    },
    "ui:flavour": "tabs",
    "ui:options": {
      "tabs": [
        {
          "title": "Base",
          "fields": [
            "update_every",
            "path",
            "exclude_path",
            "histogram"
          ]
        },
        {
          "title": "Parser",
          "fields": [
            "log_type",
            "csv_config",
            "ltsv_config",
            "regexp_config",
            "json_config"
          ]
        },
        {
          "title": "URL patterns",
          "fields": [
            "url_patterns"
          ]
        },
        {
          "title": "Custom fields",
          "fields": [
            "custom_fields",
            "custom_time_fields",
            "custom_numeric_fields"
          ]
        }
      ]
    }
  }
}