Send logs from the linelog module to stdout

work vlpl thework.vlpl at gmail.com
Wed Sep 20 12:00:29 UTC 2023


On Tue, 19 Sept 2023 at 21:34, Alan DeKok <aland at deployingradius.com> wrote:

>   This is a question for Docker, not for FreeRADIUS.
>
>   When the server runs on a normal system, it can write to /dev/stdout.
>


Yes, I understand that Docker puts additional limitations, and by
default puts such permission restrictions on /dev/stdout file, which
prevents freeradius from writing logs to that file.

But for example, when freeradius in debug mode i.e. "-fxxl stdout" I
see data from the linelog module instructions, so I hope there is
nothing too wrong with the idea of redirecting linelog output to
stdout.
Also, code that writes data to files in linelog module does a bit more
with files than just printing data to stdout/stderr, like checking
permissions, and other things.
There is already a code branch to deal with "syslog" destination, may
I ask you to consider adding something like that for stdout/stderr
destination?



diff --git a/src/modules/rlm_linelog/rlm_linelog.c
b/src/modules/rlm_linelog/rlm_linelog.c
index 8f381fc7ca..90268041cc 100644
--- a/src/modules/rlm_linelog/rlm_linelog.c
+++ b/src/modules/rlm_linelog/rlm_linelog.c
@@ -250,6 +250,11 @@ static rlm_rcode_t CC_HINT(nonnull)
mod_do_linelog(void *instance, REQUEST *requ
    }
 #endif

+   if (strcmp(inst->filename, "stdout") == 0) {
+      fprintf(stdout, "%s", line);
+      return RLM_MODULE_OK;
+   }
+
    /*
     * We're using a real filename now.
     */


More information about the Freeradius-Users mailing list