mirror of
https://github.com/NLnetLabs/unbound.git
synced 2025-12-20 23:00:56 -05:00
- log-queries: yesno option, default is no, prints querylog.
git-svn-id: file:///svn/unbound/trunk@2429 be551aaa-1e26-0410-a405-d3ace91eadb9
This commit is contained in:
parent
ecf4deedbe
commit
8def9c1043
12 changed files with 1371 additions and 1308 deletions
|
|
@ -775,6 +775,11 @@ worker_handle_request(struct comm_point* c, void* arg, int error,
|
||||||
server_stats_insrcode(&worker->stats, c->buffer);
|
server_stats_insrcode(&worker->stats, c->buffer);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
if(worker->env.cfg->log_queries) {
|
||||||
|
char ip[128];
|
||||||
|
addr_to_str(&repinfo->addr, repinfo->addrlen, ip, sizeof(ip));
|
||||||
|
log_nametypeclass(0, ip, qinfo.qname, qinfo.qtype, qinfo.qclass);
|
||||||
|
}
|
||||||
if(qinfo.qtype == LDNS_RR_TYPE_AXFR ||
|
if(qinfo.qtype == LDNS_RR_TYPE_AXFR ||
|
||||||
qinfo.qtype == LDNS_RR_TYPE_IXFR) {
|
qinfo.qtype == LDNS_RR_TYPE_IXFR) {
|
||||||
verbose(VERB_ALGO, "worker request: refused zone transfer.");
|
verbose(VERB_ALGO, "worker request: refused zone transfer.");
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,6 @@
|
||||||
|
16 June 2011: Wouter
|
||||||
|
- log-queries: yesno option, default is no, prints querylog.
|
||||||
|
|
||||||
14 June 2011: Wouter
|
14 June 2011: Wouter
|
||||||
- Use -flto compiler flag for link time optimization, if supported.
|
- Use -flto compiler flag for link time optimization, if supported.
|
||||||
- iana portlist updated.
|
- iana portlist updated.
|
||||||
|
|
|
||||||
|
|
@ -212,6 +212,9 @@ server:
|
||||||
|
|
||||||
# print UTC timestamp in ascii to logfile, default is epoch in seconds.
|
# print UTC timestamp in ascii to logfile, default is epoch in seconds.
|
||||||
# log-time-ascii: no
|
# log-time-ascii: no
|
||||||
|
|
||||||
|
# print one line with time, IP, name, type, class for every query.
|
||||||
|
# log-queries: no
|
||||||
|
|
||||||
# the pid file. Can be an absolute path outside of chroot/work dir.
|
# the pid file. Can be an absolute path outside of chroot/work dir.
|
||||||
# pidfile: "@UNBOUND_PIDFILE@"
|
# pidfile: "@UNBOUND_PIDFILE@"
|
||||||
|
|
|
||||||
|
|
@ -395,6 +395,12 @@ Sets logfile lines to use a timestamp in UTC ascii. Default is no, which
|
||||||
prints the seconds since 1970 in brackets. No effect if using syslog, in
|
prints the seconds since 1970 in brackets. No effect if using syslog, in
|
||||||
that case syslog formats the timestamp printed into the log files.
|
that case syslog formats the timestamp printed into the log files.
|
||||||
.TP
|
.TP
|
||||||
|
.B log\-queries: \fI<yes or no>
|
||||||
|
Prints one line per query to the log, with the log timestamp and IP address,
|
||||||
|
name, type and class. Default is no. Note that it takes time to print these
|
||||||
|
lines which makes the server (significantly) slower. Odd (nonprintable)
|
||||||
|
characters in names are printed as '?'.
|
||||||
|
.TP
|
||||||
.B pidfile: \fI<filename>
|
.B pidfile: \fI<filename>
|
||||||
The process id is written to the file. Default is "@UNBOUND_PIDFILE@".
|
The process id is written to the file. Default is "@UNBOUND_PIDFILE@".
|
||||||
So,
|
So,
|
||||||
|
|
|
||||||
|
|
@ -89,6 +89,7 @@ config_create(void)
|
||||||
cfg->do_tcp = 1;
|
cfg->do_tcp = 1;
|
||||||
cfg->use_syslog = 1;
|
cfg->use_syslog = 1;
|
||||||
cfg->log_time_ascii = 0;
|
cfg->log_time_ascii = 0;
|
||||||
|
cfg->log_queries = 0;
|
||||||
#ifndef USE_WINSOCK
|
#ifndef USE_WINSOCK
|
||||||
# ifdef USE_MINI_EVENT
|
# ifdef USE_MINI_EVENT
|
||||||
/* select max 1024 sockets */
|
/* select max 1024 sockets */
|
||||||
|
|
@ -382,6 +383,7 @@ int config_set_option(struct config_file* cfg, const char* opt,
|
||||||
else S_YNO("val-clean-additional:", val_clean_additional)
|
else S_YNO("val-clean-additional:", val_clean_additional)
|
||||||
else S_NUMBER_OR_ZERO("val-log-level:", val_log_level)
|
else S_NUMBER_OR_ZERO("val-log-level:", val_log_level)
|
||||||
else S_YNO("val-log-squelch:", val_log_squelch)
|
else S_YNO("val-log-squelch:", val_log_squelch)
|
||||||
|
else S_YNO("log-queries:", log_queries)
|
||||||
else S_YNO("val-permissive-mode:", val_permissive_mode)
|
else S_YNO("val-permissive-mode:", val_permissive_mode)
|
||||||
else S_YNO("ignore-cd-flag:", ignore_cd)
|
else S_YNO("ignore-cd-flag:", ignore_cd)
|
||||||
else S_STR("val-nsec3-keysize-iterations:", val_nsec3_key_iterations)
|
else S_STR("val-nsec3-keysize-iterations:", val_nsec3_key_iterations)
|
||||||
|
|
@ -580,6 +582,7 @@ config_get_option(struct config_file* cfg, const char* opt,
|
||||||
else O_STR(opt, "username", username)
|
else O_STR(opt, "username", username)
|
||||||
else O_STR(opt, "directory", directory)
|
else O_STR(opt, "directory", directory)
|
||||||
else O_STR(opt, "logfile", logfile)
|
else O_STR(opt, "logfile", logfile)
|
||||||
|
else O_YNO(opt, "log-queries", log_queries)
|
||||||
else O_STR(opt, "pidfile", pidfile)
|
else O_STR(opt, "pidfile", pidfile)
|
||||||
else O_YNO(opt, "hide-identity", hide_identity)
|
else O_YNO(opt, "hide-identity", hide_identity)
|
||||||
else O_YNO(opt, "hide-version", hide_version)
|
else O_YNO(opt, "hide-version", hide_version)
|
||||||
|
|
|
||||||
|
|
@ -192,6 +192,8 @@ struct config_file {
|
||||||
int use_syslog;
|
int use_syslog;
|
||||||
/** log timestamp in ascii UTC */
|
/** log timestamp in ascii UTC */
|
||||||
int log_time_ascii;
|
int log_time_ascii;
|
||||||
|
/** log queries with one line per query */
|
||||||
|
int log_queries;
|
||||||
|
|
||||||
/** do not report identity (id.server, hostname.bind) */
|
/** do not report identity (id.server, hostname.bind) */
|
||||||
int hide_identity;
|
int hide_identity;
|
||||||
|
|
|
||||||
1744
util/configlexer.c
1744
util/configlexer.c
File diff suppressed because it is too large
Load diff
|
|
@ -216,6 +216,7 @@ del-holddown{COLON} { YDVAR(1, VAR_DEL_HOLDDOWN) }
|
||||||
keep-missing{COLON} { YDVAR(1, VAR_KEEP_MISSING) }
|
keep-missing{COLON} { YDVAR(1, VAR_KEEP_MISSING) }
|
||||||
use-syslog{COLON} { YDVAR(1, VAR_USE_SYSLOG) }
|
use-syslog{COLON} { YDVAR(1, VAR_USE_SYSLOG) }
|
||||||
log-time-ascii{COLON} { YDVAR(1, VAR_LOG_TIME_ASCII) }
|
log-time-ascii{COLON} { YDVAR(1, VAR_LOG_TIME_ASCII) }
|
||||||
|
log-queries{COLON} { YDVAR(1, VAR_LOG_QUERIES) }
|
||||||
local-zone{COLON} { YDVAR(2, VAR_LOCAL_ZONE) }
|
local-zone{COLON} { YDVAR(2, VAR_LOCAL_ZONE) }
|
||||||
local-data{COLON} { YDVAR(1, VAR_LOCAL_DATA) }
|
local-data{COLON} { YDVAR(1, VAR_LOCAL_DATA) }
|
||||||
local-data-ptr{COLON} { YDVAR(1, VAR_LOCAL_DATA_PTR) }
|
local-data-ptr{COLON} { YDVAR(1, VAR_LOCAL_DATA_PTR) }
|
||||||
|
|
|
||||||
File diff suppressed because it is too large
Load diff
|
|
@ -154,7 +154,8 @@
|
||||||
VAR_PREFETCH_KEY = 371,
|
VAR_PREFETCH_KEY = 371,
|
||||||
VAR_SO_SNDBUF = 372,
|
VAR_SO_SNDBUF = 372,
|
||||||
VAR_HARDEN_BELOW_NXDOMAIN = 373,
|
VAR_HARDEN_BELOW_NXDOMAIN = 373,
|
||||||
VAR_IGNORE_CD_FLAG = 374
|
VAR_IGNORE_CD_FLAG = 374,
|
||||||
|
VAR_LOG_QUERIES = 375
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
/* Tokens. */
|
/* Tokens. */
|
||||||
|
|
@ -275,6 +276,7 @@
|
||||||
#define VAR_SO_SNDBUF 372
|
#define VAR_SO_SNDBUF 372
|
||||||
#define VAR_HARDEN_BELOW_NXDOMAIN 373
|
#define VAR_HARDEN_BELOW_NXDOMAIN 373
|
||||||
#define VAR_IGNORE_CD_FLAG 374
|
#define VAR_IGNORE_CD_FLAG 374
|
||||||
|
#define VAR_LOG_QUERIES 375
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -291,7 +293,7 @@ typedef union YYSTYPE
|
||||||
|
|
||||||
|
|
||||||
/* Line 1685 of yacc.c */
|
/* Line 1685 of yacc.c */
|
||||||
#line 295 "util/configparser.h"
|
#line 297 "util/configparser.h"
|
||||||
} YYSTYPE;
|
} YYSTYPE;
|
||||||
# define YYSTYPE_IS_TRIVIAL 1
|
# define YYSTYPE_IS_TRIVIAL 1
|
||||||
# define yystype YYSTYPE /* obsolescent; will be withdrawn */
|
# define yystype YYSTYPE /* obsolescent; will be withdrawn */
|
||||||
|
|
|
||||||
|
|
@ -102,7 +102,7 @@ extern struct config_parser_state* cfg_parser;
|
||||||
%token VAR_AUTO_TRUST_ANCHOR_FILE VAR_KEEP_MISSING VAR_ADD_HOLDDOWN
|
%token VAR_AUTO_TRUST_ANCHOR_FILE VAR_KEEP_MISSING VAR_ADD_HOLDDOWN
|
||||||
%token VAR_DEL_HOLDDOWN VAR_SO_RCVBUF VAR_EDNS_BUFFER_SIZE VAR_PREFETCH
|
%token VAR_DEL_HOLDDOWN VAR_SO_RCVBUF VAR_EDNS_BUFFER_SIZE VAR_PREFETCH
|
||||||
%token VAR_PREFETCH_KEY VAR_SO_SNDBUF VAR_HARDEN_BELOW_NXDOMAIN
|
%token VAR_PREFETCH_KEY VAR_SO_SNDBUF VAR_HARDEN_BELOW_NXDOMAIN
|
||||||
%token VAR_IGNORE_CD_FLAG
|
%token VAR_IGNORE_CD_FLAG VAR_LOG_QUERIES
|
||||||
|
|
||||||
%%
|
%%
|
||||||
toplevelvars: /* empty */ | toplevelvars toplevelvar ;
|
toplevelvars: /* empty */ | toplevelvars toplevelvar ;
|
||||||
|
|
@ -156,7 +156,8 @@ content_server: server_num_threads | server_verbosity | server_port |
|
||||||
server_auto_trust_anchor_file | server_add_holddown |
|
server_auto_trust_anchor_file | server_add_holddown |
|
||||||
server_del_holddown | server_keep_missing | server_so_rcvbuf |
|
server_del_holddown | server_keep_missing | server_so_rcvbuf |
|
||||||
server_edns_buffer_size | server_prefetch | server_prefetch_key |
|
server_edns_buffer_size | server_prefetch | server_prefetch_key |
|
||||||
server_so_sndbuf | server_harden_below_nxdomain | server_ignore_cd_flag
|
server_so_sndbuf | server_harden_below_nxdomain | server_ignore_cd_flag |
|
||||||
|
server_log_queries
|
||||||
;
|
;
|
||||||
stubstart: VAR_STUB_ZONE
|
stubstart: VAR_STUB_ZONE
|
||||||
{
|
{
|
||||||
|
|
@ -396,6 +397,15 @@ server_log_time_ascii: VAR_LOG_TIME_ASCII STRING_ARG
|
||||||
free($2);
|
free($2);
|
||||||
}
|
}
|
||||||
;
|
;
|
||||||
|
server_log_queries: VAR_LOG_QUERIES STRING_ARG
|
||||||
|
{
|
||||||
|
OUTYY(("P(server_log_queries:%s)\n", $2));
|
||||||
|
if(strcmp($2, "yes") != 0 && strcmp($2, "no") != 0)
|
||||||
|
yyerror("expected yes or no.");
|
||||||
|
else cfg_parser->cfg->log_queries = (strcmp($2, "yes")==0);
|
||||||
|
free($2);
|
||||||
|
}
|
||||||
|
;
|
||||||
server_chroot: VAR_CHROOT STRING_ARG
|
server_chroot: VAR_CHROOT STRING_ARG
|
||||||
{
|
{
|
||||||
OUTYY(("P(server_chroot:%s)\n", $2));
|
OUTYY(("P(server_chroot:%s)\n", $2));
|
||||||
|
|
|
||||||
|
|
@ -271,7 +271,7 @@ log_nametypeclass(enum verbosity_value v, const char* str, uint8_t* name,
|
||||||
snprintf(c, sizeof(c), "CLASS%d", (int)dclass);
|
snprintf(c, sizeof(c), "CLASS%d", (int)dclass);
|
||||||
cs = c;
|
cs = c;
|
||||||
}
|
}
|
||||||
log_info("%s <%s %s %s>", str, buf, ts, cs);
|
log_info("%s %s %s %s", str, buf, ts, cs);
|
||||||
}
|
}
|
||||||
|
|
||||||
void log_name_addr(enum verbosity_value v, const char* str, uint8_t* zone,
|
void log_name_addr(enum verbosity_value v, const char* str, uint8_t* zone,
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue