[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

11.2.7 Logging Hook Functions

A logging hook functions should be declared as follows:

Function Template: string hook (integer reqtype, string nasid, integer reqid)
reqtype
Type of the request. It can be converted to string using request_code_string function (see section 11.2.8.7 Rewrite Built-in Functions).
nasid
NAS identifier from `raddb/naslist', or its host name if not declared there
reqid
Request identifier.

Notice that the hook function shall not produce any side effects, in particular it shall not modify the incoming request in any way.

Following is an example prefix hook function that formats the incoming request data:

 
string
compat_log_prefix(integer reqtype, string nas, integer id)
{
        string result;

        return "(" + request_code_string(reqtype) + " "
                   + nas + " " + (string)id + " " + %[User-Name] + ")";
}

Here is a sample log produced by radiusd before and after enabling this function:

 
Auth.notice: Login OK [jsmith]
...
Auth.notice: (AUTHREQ nas-2 251 jsmith): Login OK [jsmith]



This document was generated by Sergey Poznyakoff on November, 20 2004 using texi2html