Skip to content

Commit 1809275

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 dd5f1e9 commit 1809275

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/modules/rlm_linelog/rlm_linelog.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,7 @@ typedef struct {
122122
exfile_t *ef; //!< Exclusive file access handle.
123123
bool escape; //!< Do filename escaping, yes / no.
124124
bool fsync; //!< fsync after each write.
125+
fr_time_delta_t max_idle; //!< How long to keep file metadata around without activity.
125126
} file;
126127

127128
struct {
@@ -147,6 +148,7 @@ static const conf_parser_t file_config[] = {
147148
{ FR_CONF_OFFSET("group", rlm_linelog_t, file.group_str) },
148149
{ FR_CONF_OFFSET("escape_filenames", rlm_linelog_t, file.escape), .dflt = "no" },
149150
{ FR_CONF_OFFSET("fsync", rlm_linelog_t, file.fsync), .dflt = "no" },
151+
{ FR_CONF_OFFSET("max_idle", rlm_linelog_t, file.max_idle), .dflt = "30s" },
150152
CONF_PARSER_TERMINATOR
151153
};
152154

@@ -966,7 +968,7 @@ static int mod_instantiate(module_inst_ctx_t const *mctx)
966968
}
967969
if (!cf_pair_find(cs, "filename")) goto no_filename;
968970

969-
inst->file.ef = module_rlm_exfile_init(inst, conf, 256, fr_time_delta_from_sec(30), true,
971+
inst->file.ef = module_rlm_exfile_init(inst, conf, 256, inst->file.max_idle, true,
970972
inst->triggers, NULL, NULL);
971973
if (!inst->file.ef) {
972974
cf_log_err(conf, "Failed creating log file context");

0 commit comments

Comments
 (0)