coredns/middleware/log
Miek Gieben 090d1872e9 Golint2 (#280)
* Fix linter errors

* More linting fixes

* More docs and making members private that dont need to be public

* Fix linter errors

* More linting fixes

* More docs and making members private that dont need to be public

* More lint fixes

This leaves:

~~~
middleware/kubernetes/nametemplate/nametemplate.go:64:6: exported type NameTemplate should have comment or be unexported
middleware/kubernetes/nametemplate/nametemplate.go:71:1: exported method NameTemplate.SetTemplate should have comment or be unexported
middleware/kubernetes/nametemplate/nametemplate.go:108:1: exported method NameTemplate.GetZoneFromSegmentArray should have comment or be unexported
middleware/kubernetes/nametemplate/nametemplate.go:116:1: exported method NameTemplate.GetNamespaceFromSegmentArray should have comment or be unexported
middleware/kubernetes/nametemplate/nametemplate.go:120:1: exported method NameTemplate.GetServiceFromSegmentArray should have comment or be unexported
middleware/kubernetes/nametemplate/nametemplate.go:124:1: exported method NameTemplate.GetTypeFromSegmentArray should have comment or be unexported
middleware/kubernetes/nametemplate/nametemplate.go:135:1: exported method NameTemplate.GetSymbolFromSegmentArray should have comment or be unexported
middleware/kubernetes/nametemplate/nametemplate.go:167:1: exported method NameTemplate.IsValid should have comment or be unexported
middleware/kubernetes/nametemplate/nametemplate.go:182:6: exported type NameValues should have comment or be unexported
middleware/kubernetes/util/util.go:1:1: package comment should be of the form "Package util ..."
middleware/kubernetes/util/util.go:27:2: exported const WildcardStar should have comment (or a comment on this block) or be unexported
middleware/proxy/lookup.go:66:1: exported method Proxy.Forward should have comment or be unexported
middleware/proxy/proxy.go:24:6: exported type Client should have comment or be unexported
middleware/proxy/proxy.go:107:1: exported function Clients should have comment or be unexported
middleware/proxy/reverseproxy.go:10:6: exported type ReverseProxy should have comment or be unexported
middleware/proxy/reverseproxy.go:16:1: exported method ReverseProxy.ServeDNS should have comment or be unexported
middleware/proxy/upstream.go:42:6: exported type Options should have comment or be unexported
~~~

I plan on reworking the proxy anyway, so I'll leave that be.
2016-09-23 09:14:12 +01:00
..
log.go Golint2 (#280) 2016-09-23 09:14:12 +01:00
log_test.go Cleanup: put middleware helper functions in pkgs (#245) 2016-09-07 11:10:16 +01:00
README.md Remove lumberjack logger (#257) 2016-09-16 15:50:16 +01:00
setup.go Cleanups and tests (#272) 2016-09-19 11:26:00 +01:00
setup_test.go Remove lumberjack logger (#257) 2016-09-16 15:50:16 +01:00

log

log enables request logging. The request log is also known in some vernacular as an access log.

Syntax

log
  • With no arguments, a query log entry is written to query.log in the common log format for all requests (base name = .).
log file
  • file is the log file to create (or append to). The base path is assumed to be . .
log name file [format]
  • name is the base name to match in order to be logged
  • file is the log file to create (or append to)
  • format is the log format to use (default is Common Log Format)

Log File

The log file can be any filename. It could also be stdout or stderr to write the log to the console, or syslog to write to the system log (except on Windows). If the log file does not exist beforehand, CoreDNS will create it before appending to it.

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).
  • {when}: time of the query.
  • {remote}: client's IP address.
  • {port}: client's port.
  • {rcode}: response RCODE.
  • {size}: response size.
  • {duration}: response duration.
  • {>bufsize}: the EDNS0 buffer size advertized by the client.
  • {>do}: is the EDNS0 DO (DNSSEC OK) bit set.
  • {>id}: query ID
  • {>opcode}: query OPCODE

Examples

Log all requests to a file:

log /var/log/query.log

Custom log format:

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