all: export querylog docs

This commit is contained in:
Dimitry Kolyshev 2023-05-29 13:29:41 +03:00
parent ea8d634f65
commit f4f2c11eb9
4 changed files with 59 additions and 0 deletions

View file

@ -25,6 +25,9 @@ NOTE: Add new changes BELOW THIS COMMENT.
### Added
- The new HTTP API, `GET /control/querylog/export`, which can be used to
export query log items. See `openapi/openapi.yaml` for the full description
([#3389]).
- The ability to edit rewrite rules via `PUT /control/rewrite/update` HTTP API
([#1577]).
@ -41,6 +44,7 @@ NOTE: Add new changes BELOW THIS COMMENT.
UDP/TCP upstream servers.
[#1577]: https://github.com/AdguardTeam/AdGuardHome/issues/1577
[#3389]: https://github.com/AdguardTeam/AdGuardHome/issues/3389
[#5716]: https://github.com/AdguardTeam/AdGuardHome/issues/5716
<!--

View file

@ -62,6 +62,7 @@ func (l *queryLog) initWeb() {
l.conf.HTTPRegister(http.MethodGet, "/control/querylog", l.handleQueryLog)
l.conf.HTTPRegister(http.MethodPost, "/control/querylog_clear", l.handleQueryLogClear)
l.conf.HTTPRegister(http.MethodGet, "/control/querylog/config", l.handleGetQueryLogConfig)
l.conf.HTTPRegister(http.MethodGet, "/control/querylog/export", l.handleQueryLogExport)
l.conf.HTTPRegister(
http.MethodPut,
"/control/querylog/config/update",
@ -96,6 +97,14 @@ func (l *queryLog) handleQueryLog(w http.ResponseWriter, r *http.Request) {
_ = aghhttp.WriteJSONResponse(w, r, resp)
}
// handleQueryLogExport is the handler for the GET /control/querylog/export
// HTTP API.
//
// TODO(d.kolyshev): !! Implement handleQueryLogExport.
func (l *queryLog) handleQueryLogExport(w http.ResponseWriter, r *http.Request) {
aghhttp.Error(r, w, http.StatusBadRequest, "not implemented")
}
// handleQueryLogClear is the handler for the POST /control/querylog/clear HTTP
// API.
func (l *queryLog) handleQueryLogClear(_ http.ResponseWriter, _ *http.Request) {

View file

@ -6,6 +6,11 @@
## v0.107.30: API changes
### New HTTP API 'GET /control/querylog/export'
* The new `GET /control/querylog/export` HTTP API allows an export of query log
items in the CSV file.
### `POST /control/version.json` and `GET /control/dhcp/interfaces` content type
* The value of the `Content-Type` header in the `POST /control/version.json` and

View file

@ -313,6 +313,47 @@
'responses':
'200':
'description': 'OK.'
'/querylog/export':
'get':
'tags':
- 'log'
'description': >
Returns a CSV file stream with the following fields, sorted a-z:
ans_dnssec, ans_rcode, ans_type, ans_value, cached, client_ip,
clientid, ecs, elapsed, filter_id, filter_rule, proto, qclass, qname,
qtype, reason, time, upstream. The fields list is a subject to change.
The content is UTF-8 encoded with quotation marks.
'operationId': 'getQueryLogExport'
'summary': 'Get DNS server query log items in a CSV stream.'
'parameters':
- 'name': 'search'
'in': 'query'
'description': 'Filter by domain name or client IP'
'schema':
'type': 'string'
- 'name': 'response_status'
'in': 'query'
'description': 'Filter by response status'
'schema':
'type': 'string'
'enum':
- 'all'
- 'filtered'
- 'blocked'
- 'blocked_safebrowsing'
- 'blocked_parental'
- 'whitelisted'
- 'rewritten'
- 'safe_search'
- 'processed'
'responses':
'200':
'description': 'OK.'
'content':
'text/csv':
schema:
type: string
'/stats':
'get':
'tags':