aboutsummaryrefslogtreecommitdiff
path: root/parse.y
diff options
context:
space:
mode:
authorOmar Polo <op@omarpolo.com>2023-07-24 08:50:49 +0000
committerOmar Polo <op@omarpolo.com>2023-07-24 08:50:49 +0000
commit226f13ece0b309abeee0ae8a4d8c9f049fe896a7 (patch)
treebb0d3efb3ff5064a04335eca0d615444f7696655 /parse.y
parent3826d7de43d3b9078c5e18e0074799a3a9ee682e (diff)
add ability to log to files with log access <path>
Diffstat (limited to 'parse.y')
-rw-r--r--parse.y25
1 files changed, 23 insertions, 2 deletions
diff --git a/parse.y b/parse.y
index 479c094..674437b 100644
--- a/parse.y
+++ b/parse.y
@@ -122,7 +122,7 @@ typedef struct {
/* for bison: */
/* %define parse.error verbose */
-%token ALIAS AUTO
+%token ACCESS ALIAS AUTO
%token BLOCK
%token CA CERT CHROOT CLIENT
%token DEFAULT
@@ -133,7 +133,7 @@ typedef struct {
%token OCSP OFF ON
%token PARAM PORT PREFORK PROTO PROTOCOLS PROXY
%token RELAY_TO REQUIRE RETURN ROOT
-%token SERVER SNI SOCKET STRIP
+%token SERVER SNI SOCKET STRIP SYSLOG
%token TCP TOEXT TYPE TYPES
%token USE_TLS USER
%token VERIFYNAME
@@ -232,6 +232,7 @@ option : CHROOT string {
else
default_host = "0.0.0.0";
}
+ | log
| PORT NUM {
yywarn("option `port' is deprecated,"
" please use `listen on'");
@@ -251,6 +252,24 @@ option : CHROOT string {
}
;
+log : LOG '{' optnl logopts '}'
+ | LOG logopt
+ ;
+
+logopts : /* empty */
+ | logopts logopt optnl
+ ;
+
+logopt : SYSLOG {
+ free(conf->log_access);
+ conf->log_access = NULL;
+ }
+ | ACCESS string {
+ free(conf->log_access);
+ conf->log_access = $2;
+ }
+ ;
+
vhost : SERVER string {
host = new_vhost();
TAILQ_INSERT_HEAD(&conf->hosts, host, vhosts);
@@ -576,6 +595,7 @@ static const struct keyword {
int token;
} keywords[] = {
/* these MUST be sorted */
+ {"access", ACCESS},
{"alias", ALIAS},
{"auto", AUTO},
{"block", BLOCK},
@@ -611,6 +631,7 @@ static const struct keyword {
{"sni", SNI},
{"socket", SOCKET},
{"strip", STRIP},
+ {"syslog", SYSLOG},
{"tcp", TCP},
{"to-ext", TOEXT},
{"type", TYPE},