| 1 | { |
| 2 | "jsonSchema": { |
| 3 | "$schema": "http://json-schema.org/draft-07/schema#", |
| 4 | "type": "object", |
| 5 | "properties": { |
| 6 | "update_every": { |
| 7 | "title": "Update every", |
| 8 | "description": "Data collection interval, measured in seconds.", |
| 9 | "type": "integer", |
| 10 | "minimum": 1, |
| 11 | "default": 1 |
| 12 | }, |
| 13 | "path": { |
| 14 | "title": "Log file", |
| 15 | "description": "The file path to the Squid server log file.", |
| 16 | "type": "string", |
| 17 | "default": "/var/log/squid/access.log", |
| 18 | "pattern": "^$|^/" |
| 19 | }, |
| 20 | "exclude_path": { |
| 21 | "title": "Exclude path", |
| 22 | "description": "Pattern to exclude log files.", |
| 23 | "type": "string", |
| 24 | "default": "*.gz" |
| 25 | }, |
| 26 | "log_type": { |
| 27 | "title": "Log parser", |
| 28 | "description": "Type of parser to use for parsing the Squid server log file.", |
| 29 | "type": "string", |
| 30 | "enum": [ |
| 31 | "csv", |
| 32 | "regexp", |
| 33 | "json", |
| 34 | "ltsv" |
| 35 | ], |
| 36 | "default": "csv" |
| 37 | } |
| 38 | }, |
| 39 | "required": [ |
| 40 | "path", |
| 41 | "log_type" |
| 42 | ], |
| 43 | "dependencies": { |
| 44 | "log_type": { |
| 45 | "oneOf": [ |
| 46 | { |
| 47 | "properties": { |
| 48 | "log_type": { |
| 49 | "const": "csv" |
| 50 | }, |
| 51 | "csv_config": { |
| 52 | "title": "CSV parser configuration", |
| 53 | "type": [ |
| 54 | "object", |
| 55 | "null" |
| 56 | ], |
| 57 | "properties": { |
| 58 | "format": { |
| 59 | "title": "Format", |
| 60 | "description": "Log format.", |
| 61 | "type": "string", |
| 62 | "default": "$remote_addr - - [$time_local] \"$request\" $status $body_bytes_sent" |
| 63 | }, |
| 64 | "delimiter": { |
| 65 | "title": "Delimiter", |
| 66 | "description": "Delimiter used to separate fields in the log file. Default: space (' ').", |
| 67 | "type": "string", |
| 68 | "default": " " |
| 69 | } |
| 70 | }, |
| 71 | "required": [ |
| 72 | "format", |
| 73 | "delimiter" |
| 74 | ] |
| 75 | } |
| 76 | }, |
| 77 | "required": [ |
| 78 | "csv_config" |
| 79 | ] |
| 80 | }, |
| 81 | { |
| 82 | "properties": { |
| 83 | "log_type": { |
| 84 | "const": "regexp" |
| 85 | }, |
| 86 | "regexp_config": { |
| 87 | "title": "Regular expression parser configuration", |
| 88 | "type": [ |
| 89 | "object", |
| 90 | "null" |
| 91 | ], |
| 92 | "properties": { |
| 93 | "pattern": { |
| 94 | "title": "Pattern with named groups", |
| 95 | "description": "Regular expression pattern with named groups. Use named groups for known fields.", |
| 96 | "type": "string", |
| 97 | "default": "" |
| 98 | } |
| 99 | }, |
| 100 | "required": [ |
| 101 | "pattern" |
| 102 | ] |
| 103 | } |
| 104 | }, |
| 105 | "required": [ |
| 106 | "regexp_config" |
| 107 | ] |
| 108 | }, |
| 109 | { |
| 110 | "properties": { |
| 111 | "log_type": { |
| 112 | "const": "json" |
| 113 | }, |
| 114 | "json_config": { |
| 115 | "title": "JSON parser configuration", |
| 116 | "type": [ |
| 117 | "object", |
| 118 | "null" |
| 119 | ], |
| 120 | "properties": { |
| 121 | "mapping": { |
| 122 | "title": "Field mapping", |
| 123 | "description": "Dictionary mapping fields in logs to known fields.", |
| 124 | "type": [ |
| 125 | "object", |
| 126 | "null" |
| 127 | ], |
| 128 | "additionalProperties": { |
| 129 | "type": "string" |
| 130 | } |
| 131 | } |
| 132 | } |
| 133 | } |
| 134 | } |
| 135 | }, |
| 136 | { |
| 137 | "properties": { |
| 138 | "log_type": { |
| 139 | "const": "ltsv" |
| 140 | }, |
| 141 | "ltsv_config": { |
| 142 | "title": "LTSV parser configuration", |
| 143 | "type": [ |
| 144 | "object", |
| 145 | "null" |
| 146 | ], |
| 147 | "properties": { |
| 148 | "field_delimiter": { |
| 149 | "title": "Field delimiter", |
| 150 | "description": "Delimiter used to separate fields in LTSV logs. Default: tab ('\\t').", |
| 151 | "type": "string", |
| 152 | "default": "\t" |
| 153 | }, |
| 154 | "value_delimiter": { |
| 155 | "title": "Value delimiter", |
| 156 | "description": "Delimiter used to separate label-value pairs in LTSV logs.", |
| 157 | "type": "string", |
| 158 | "default": ":" |
| 159 | }, |
| 160 | "mapping": { |
| 161 | "title": "Field mapping", |
| 162 | "description": "Dictionary mapping fields in logs to known fields.", |
| 163 | "type": [ |
| 164 | "object", |
| 165 | "null" |
| 166 | ], |
| 167 | "additionalProperties": { |
| 168 | "type": "string" |
| 169 | } |
| 170 | } |
| 171 | } |
| 172 | } |
| 173 | } |
| 174 | } |
| 175 | ] |
| 176 | } |
| 177 | } |
| 178 | }, |
| 179 | "uiSchema": { |
| 180 | "uiOptions": { |
| 181 | "fullPage": true |
| 182 | }, |
| 183 | "log_type": { |
| 184 | "ui:widget": "radio", |
| 185 | "ui:options": { |
| 186 | "inline": true |
| 187 | } |
| 188 | }, |
| 189 | "ui:flavour": "tabs", |
| 190 | "ui:options": { |
| 191 | "tabs": [ |
| 192 | { |
| 193 | "title": "Base", |
| 194 | "fields": [ |
| 195 | "update_every", |
| 196 | "path", |
| 197 | "exclude_path" |
| 198 | ] |
| 199 | }, |
| 200 | { |
| 201 | "title": "Parser", |
| 202 | "fields": [ |
| 203 | "log_type", |
| 204 | "csv_config", |
| 205 | "ltsv_config", |
| 206 | "regexp_config", |
| 207 | "json_config" |
| 208 | ] |
| 209 | } |
| 210 | ] |
| 211 | } |
| 212 | } |
| 213 | } |