Skip to content

Commit 729837e

Browse files
feat: Added max_idle config option to linelog file structure which can be useful in testing
Signed-off-by: ethan-thompson <ethan.thompson@networkradius.com>
1 parent 62b1943 commit 729837e

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

src/modules/rlm_linelog/rlm_linelog.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,7 @@ static const conf_parser_t file_config[] = {
9191
{ FR_CONF_OFFSET("group", rlm_linelog_t, file.group_str) },
9292
{ FR_CONF_OFFSET("escape_filenames", rlm_linelog_t, file.escape), .dflt = "no" },
9393
{ FR_CONF_OFFSET("fsync", rlm_linelog_t, file.fsync), .dflt = "no" },
94+
{ FR_CONF_OFFSET("max_idle", rlm_linelog_t, file.max_idle), .dflt = "30s" },
9495
{ FR_CONF_OFFSET("buffer_count", rlm_linelog_t, file.buffer_count), .dflt = "1000" },
9596
{ FR_CONF_OFFSET_IS_SET("buffer_delay", FR_TYPE_TIME_DELTA, 0, rlm_linelog_t, file.buffer_delay), .dflt = "1s" },
9697
{ FR_CONF_OFFSET_IS_SET("buffer_expiry", FR_TYPE_TIME_DELTA, CONF_FLAG_HIDDEN, rlm_linelog_t, file.buffer_expiry), .dflt = "30s" },
@@ -958,7 +959,7 @@ static int mod_instantiate(module_inst_ctx_t const *mctx)
958959
}
959960
if (!cf_pair_find(cs, "filename")) goto no_filename;
960961

961-
inst->file.ef = module_rlm_exfile_init(inst, conf, 256, fr_time_delta_from_sec(30), true,
962+
inst->file.ef = module_rlm_exfile_init(inst, conf, 256, inst->file.max_idle, true,
962963
inst->triggers, NULL, NULL);
963964
if (!inst->file.ef) {
964965
cf_log_err(conf, "Failed creating log file context");

src/modules/rlm_linelog/rlm_linelog.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ typedef struct {
6666
exfile_t *ef; //!< Exclusive file access handle.
6767
bool escape; //!< Do filename escaping, yes / no.
6868
bool fsync; //!< fsync after each write.
69+
fr_time_delta_t max_idle; //!< How long to keep file metadata around without activity.
6970
bool buffer_write; //!< Whether buffering is enabled.
7071
uint32_t buffer_count; //!< Max number of entries to buffer before writing.
7172
fr_time_delta_t buffer_delay; //!< Max time to wait before flushing buffer.

0 commit comments

Comments
 (0)