Rename /api/ftl/logs/dns -> /api/logs/dnsmasq

Signed-off-by: DL6ER <dl6er@dl6er.de>
This commit is contained in:
DL6ER
2023-01-16 21:41:10 +01:00
parent c34975180e
commit c901194d3b
7 changed files with 176 additions and 79 deletions
+80
View File
@@ -0,0 +1,80 @@
openapi: 3.0.2
components:
paths:
logs:
dnsmasq:
get:
summary: Get DNS log content
tags:
- "FTL information"
operationId: "get_dns_log"
description: |
This API hook returns content from the log of the embedded DNS resolver `dnsmasq`.
Every successful request will return a `nextID`.
This ID can be used on the next request to only get lines which were added *after* the last request.
This makes periodic polling for new log lines easy as no check for duplicated log lines is necessary.
The expected behavior for an immediate re-request of a log line with the same ID is an empty response.
As soon as the next message arrived, this will be included in your request and `nextID` is incremented by one.
parameters:
- $ref: 'logs.yaml#/components/parameters/logs/dnsmasq/nextID'
responses:
'200':
description: OK
content:
application/json:
schema:
allOf:
- $ref: 'logs.yaml#/components/schemas/logs/dnsmasq/log'
- $ref: 'logs.yaml#/components/schemas/logs/dnsmasq/nextID'
'401':
description: Unauthorized
content:
application/json:
schema:
$ref: 'common.yaml#/components/errors/unauthorized'
schemas:
logs:
dnsmasq:
log:
type: object
properties:
log:
type: array
description: Request headers
items:
type: object
properties:
timestamp:
type: number
description: Unix timestamp of log line creation (server time)
message:
type: string
description: Log line content
example:
- timestamp: 1611729969.0
message: "started, version pi-hole-2.84 cachesize 10000"
- timestamp: 1611729969.0
message: "reading /etc/resolv.conf"
- timestamp: 1611729969.0
message: "read /etc/hosts - 7 addresses"
- timestamp: 1611729969.0
message: "query[A] connectivity-check.ubuntu.com from 127.0.0.1"
nextID:
type: object
properties:
nextID:
type: integer
description: next ID to query if checking for new log lines
example: 229
parameters:
logs:
dnsmasq:
nextID:
in: query
description: (Optional) ID of next line to return
name: nextID
schema:
type: integer
required: false
example: 219
+3 -3
View File
@@ -144,15 +144,15 @@ paths:
/ftl/client:
$ref: 'ftl.yaml#/components/paths/client'
/ftl/logs/dns:
$ref: 'ftl.yaml#/components/paths/logs/dns'
/ftl/sysinfo:
$ref: 'ftl.yaml#/components/paths/sysinfo'
/ftl/dbinfo:
$ref: 'ftl.yaml#/components/paths/dbinfo'
/logs/dnsmasq:
$ref: 'logs.yaml#/components/paths/logs/dnsmasq'
/endpoints:
$ref: 'endpoints.yaml#/components/paths/endpoints'