debug log [was Re: freeradius ippool issue]

Josip Rodin joy at entuzijast.net
Fri Jul 18 15:19:17 CEST 2008


On Fri, Jul 18, 2008 at 01:46:30PM +0200, Alan DeKok wrote:
> > BTW, while we're on the topic - Navis RADIUS has the option of having log
> > files be automatically switched based on timestamps. In other words, if you
> > set a log file to be 'TimeFile', and set attributes 'FormatTimestamp=TRUE',
> > 'Prefix=/var/log/foo/bar-', 'Mode=DAILY', and then it creates the log files
> > named /var/log/foo/bar-20080718, and automatically moves on as necessary.
> > 
> > That sounds like a reasonably useful facility for debugging logs - makes
> > the rotation and lookups a bit smarter than the usual fodder created by
> > logrotate. And it's also similar to how radacct/detail files are written.
> 
>   This is supported.  Just add a date string to the name of the debug
> log file, just like is done with the "detail" files.

Oh. These seemingly random expansions have always surprised me. The other
day I just happened to stumble upon that when writing:

	if ((Connect-Info != "NONE") && (Connect-Info < "%Y%m%d")) {

It would be good if this was documented somewhere - I actually looked in
the unlang manual page for a way to get a date string, but found nothing.

So I tried running date(1) inside backticks for a start, but then I noticed
that freeradius was expanding those expressions in the command line
arguments. Then I tried to get the same in a normal quoted string, and
it worked. Magic. :)

The unlang(5) manual says:
 
  Double-quoted strings are expanded by inserting the value of any
  variables (see VARIABLES, below) before being evaluated.

However, the VARIABLES section doesn't mention that those date-format
strings are actually treated as variables whose names are single letters.
It does mention the results of regular expression matches, where there
are eight variables whose names are single numbers, so this looks like
an omission.

I'd write a proper patch, but I haven't looked at the source yet, to see
which exact set of date formats are supported...?

-- 
     2. That which causes joy or happiness.



More information about the Freeradius-Users mailing list