#
server default {
#
- # namespace::
+ # namespace:: The protocol namespace (i.e. dictionary) to use.
#
# In v4, all "server" sections MUST start with a "namespace"
# parameter. This tells the server which protocol is being used.
#
namespace = radius
+ #
+ # log:: The name of the logging section to use.
+ #
+ # The top configuration section can contain multiple section "log foo { ... }".
+ # Each of those sections is a different named logging destination.
+ #
+ # This configuration item allows setting a different logging destination for an
+ # individual virtual server.
+ #
+ # There are some limitations.
+ #
+ # * this logging is in _addition_ to the default logging to "log { .... }".
+ # * it is not currently possible to _replace_ the default logging destination
+ # * the name given here _must_ be a fixed string, and is not dynamically expanded.
+ #
+# log = some_other_logging_destination
+
#
# ### RADIUS Configuration
#
if (log->dst != L_DST_FILES) return;
+ fr_assert(log->file != NULL);
+
fr_rb_insert(filename_tree, dst);
}
char const *name;
name = cf_section_name2(cs);
- if (!name) name = cf_section_name1(cs);
+ if (!name) name = "DEFAULT";
dst = fr_rb_find(dst_tree, &(fr_log_track_t) {
.name = name,
///< cached for convenience.
fr_rb_tree_t *sections; //!< List of sections that need to be compiled.
+
+ fr_log_t *log; //!< log destination
+ char const *log_name; //!< name of log destination
};
static fr_dict_t const *dict_freeradius;
.subcs_size = sizeof(fr_virtual_listen_t), .subcs_type = "fr_virtual_listen_t",
.func = listen_parse },
+ { FR_CONF_OFFSET("log", virtual_server_t, log_name), },
+
CONF_PARSER_TERMINATOR
};
return UNLANG_ACTION_FAIL;
}
+ /*
+ * Log here, too.
+ */
+ if (server->log) request_log_prepend(request, server->log, fr_debug_lvl);
+
/*
* Bootstrap the stack with a module instance.
*/
CONF_ITEM *ci = NULL;
CONF_SECTION *server_cs = virtual_servers[i]->server_cs;
fr_dict_t const *dict;
- virtual_server_t const *vs = virtual_servers[i];
+ virtual_server_t *vs = virtual_servers[i];
fr_process_module_t const *process = (fr_process_module_t const *)
vs->process_mi->module->exported;
+ /*
+ * Set up logging before doing anything else.
+ */
+ if (vs->log_name) {
+ vs->log = log_dst_by_name(vs->log_name);
+ if (!vs->log) {
+ CONF_PAIR *cp = cf_pair_find(server_cs, "log");
+
+ if (cp) {
+ cf_log_err(cp, "Unknown log destination '%s'", vs->log_name);
+ } else {
+ cf_log_err(server_cs, "Unknown log destination '%s'", vs->log_name);
+ }
+
+ return -1;
+ }
+ }
+
dict = virtual_server_local_dict(server_cs, *(process)->dict);
if (!dict) return -1;