惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
Microsoft Azure Blog
Microsoft Azure Blog
大猫的无限游戏
大猫的无限游戏
月光博客
月光博客
V
V2EX
PCI Perspectives
PCI Perspectives
Latest news
Latest news
博客园 - 三生石上(FineUI控件)
C
CERT Recently Published Vulnerability Notes
W
WeLiveSecurity
Last Week in AI
Last Week in AI
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
P
Palo Alto Networks Blog
T
The Exploit Database - CXSecurity.com
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
WordPress大学
WordPress大学
V
Vulnerabilities – Threatpost
H
Heimdal Security Blog
Attack and Defense Labs
Attack and Defense Labs
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
Hacker News: Ask HN
Hacker News: Ask HN
博客园 - 叶小钗
V
Visual Studio Blog
Jina AI
Jina AI
P
Proofpoint News Feed
罗磊的独立博客
SecWiki News
SecWiki News
J
Java Code Geeks
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
L
LINUX DO - 热门话题
Security Archives - TechRepublic
Security Archives - TechRepublic
The Hacker News
The Hacker News
Hugging Face - Blog
Hugging Face - Blog
N
News and Events Feed by Topic
NISL@THU
NISL@THU
T
Tailwind CSS Blog
T
Tenable Blog
Recent Commits to openclaw:main
Recent Commits to openclaw:main
Recent Announcements
Recent Announcements
H
Hacker News: Front Page
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
T
Tor Project blog
宝玉的分享
宝玉的分享
Help Net Security
Help Net Security
S
Security Affairs
Microsoft Security Blog
Microsoft Security Blog
Google DeepMind News
Google DeepMind News
F
Fortinet All Blogs
G
GRAHAM CLULEY

Plugins on CoreDNS: DNS and Service Discovery

kubernetes proxyproto rewrite forward clouddns errors grpc_server https https3 template auto geoip multisocket nomad dnstap import view ready etcd header loadbalance bind grpc file prometheus quic timeouts autopath dnssec root tls bufsize k8s_external reload acl cache health trace tsig route53 dns64 transfer secondary loop minimal sign azure local any cancel debug erratic metadata nsid pprof hosts chaos whoami
log
2026-03-07 · via Plugins on CoreDNS: DNS and Service Discovery

Description

By just using log you dump all queries (and parts for the reply) on standard output. Options exist to tweak the output a little. Note that for busy servers logging will incur a performance hit.

Enabling or disabling the log plugin only affects the query logging, any other logging from CoreDNS will show up regardless.

Syntax

With no arguments, a query log entry is written to stdout in the common log format for all requests. Or if you want/need slightly more control:

  • NAMES is the name list to match in order to be logged
  • FORMAT is the log format to use (default is Common Log Format), {common} is used as a shortcut for the Common Log Format. You can also use {combined} for a format that adds the query opcode {>opcode} to the Common Log Format.

You can further specify the classes of responses that get logged:

log [NAMES...] [FORMAT] {
    class CLASSES...
}
  • CLASSES is a space-separated list of classes of responses that should be logged

The classes of responses have the following meaning:

  • success: successful response
  • denial: either NXDOMAIN or nodata responses (Name exists, type does not). A nodata response sets the return code to NOERROR.
  • error: SERVFAIL, NOTIMP, REFUSED, etc. Anything that indicates the remote server is not willing to resolve the request.
  • all: the default - nothing is specified. Using of this class means that all messages will be logged whatever we mix together with “all”.

If no class is specified, it defaults to all.

Log Format

You can specify a custom log format with any placeholder values. Log supports both request and response placeholders.

The following place holders are supported:

  • {type}: qtype of the request
  • {name}: qname of the request
  • {class}: qclass of the request
  • {proto}: protocol used (tcp or udp)
  • {remote}: client’s IP address, for IPv6 addresses these are enclosed in brackets: [::1]
  • {local}: server’s IP address, for IPv6 addresses these are enclosed in brackets: [::1]
  • {size}: request size in bytes
  • {port}: client’s port
  • {duration}: response duration
  • {rcode}: response RCODE
  • {rsize}: raw (uncompressed), response size (a client may receive a smaller response)
  • {>rflags}: response flags, each set flag will be displayed, e.g. “aa, tc”. This includes the qr bit as well
  • {>bufsize}: the EDNS0 buffer size advertised in the query
  • {>do}: is the EDNS0 DO (DNSSEC OK) bit set in the query
  • {>id}: query ID
  • {>opcode}: query OPCODE
  • {common}: the default Common Log Format.
  • {combined}: the Common Log Format with the query opcode.
  • {/LABEL}: any metadata label is accepted as a place holder if it is enclosed between {/ and }, the place holder will be replaced by the corresponding metadata value or the default value - if label is not defined. See the metadata plugin for more information.

The default Common Log Format is:

`{remote}:{port} - {>id} "{type} {class} {name} {proto} {size} {>do} {>bufsize}" {rcode} {>rflags} {rsize} {duration}`

Each of these logs will be outputted with log.Infof, so a typical example looks like this:

[INFO] [::1]:50759 - 29008 "A IN example.org. udp 41 false 4096" NOERROR qr,rd,ra,ad 68 0.037990251s

The log plugin adds the following metadata to allow for granular differentiation of NOERROR denial vs success messages. These are mapped from plugin/pkg/response/classify.go and plugin/pkg/response/typify.go.

  • {/log/class}: success, denial
  • {/log/type}: NODATA, NXDOMAIN, NOERROR
. {
    log . "{proto} Request: {name} {type} {/log/class} {/log/type}"
}

Examples

Log all requests to stdout

. {
    log
    whoami
}

Custom log format, for all zones (.)

. {
    log . "{proto} Request: {name} {type} {>id}"
}

Only log denials (NXDOMAIN and nodata) for example.org (and below)

. {
    log example.org {
        class denial
    }
}

Log all queries which were not resolved successfully in the Combined Log Format.

. {
    log . {combined} {
        class denial error
    }
}

Log all queries on which we did not get errors

. {
    log . {
        class denial success
    }
}

Also the multiple statements can be OR-ed, for example, we can rewrite the above case as following:

. {
    log . {
        class denial
        class success
    }
}