Ascend Archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: (ASCEND) Patch: radiusd uses db library



Andre Beck <beck@ibh-dd.de> writes:

> Now we should challenge the next problem: a configurable output format
> for radius accounting. I have patched my radiusd in order to get a more
> civilized one-line output (called "summary") instead of the fat and
> overspecific "detail" output that radiusd provides by default (and that
> looks to me like an intermediate solution that never made it complete).
> But this patch is also nothing but a hack, changing the output to any-
> thing different (even adding a field) is code-change and recompile. So
> it would be great to have an option to adapt the log format to any
> personal need, f.i.:
> 
> "%t %Acct-Status-Type %User-Name %Acct-Session-Time %Acct-Input-Octets\
>  %Acct-Output-Octets %Framed-Address\n"
> 
> to generate the format I'm currently using (with %t beeing a timestamp
> in Unix epoch format). It should be possible to resemble the old
> format as well (maybe "%O") and make that the default so everyone
> is pleased - even if they are using "detail" log at the moment (which
> is a hell to parse).
> 
> Anyone with enough time to code this ?

Well, for summaries it is no big deal to run simple scripts on the
details file. As an example I have appended the one I pipe into
egrep -i username  if someone calls with "Why am I having trouble
connecting to the Internet"

-- 
Manfred Kwiatkowski, ZRZ (Zentraleinrichtung Rechenzentrum), Sekr.: EN 50,
Technische Universitaet Berlin, Einsteinufer 17, D-10587 Berlin, GERMANY.
INTERNET: kwiatkowski@zrz.TU-Berlin.DE             phone: +49 30 314 24355
X.400: s=kwiatkowski ou=zrz p=tu-berlin a=d400 c=de  fax: +49 30 314 21060

------------------------ cut here ---------------------------------
#!/bin/sh
tr "\"." "  " | /usr/local/bin/gawk '

BEGIN{
USER="";RATE=-1;
}
/:/ {DATE=sprintf("%s%3s %s",$2,$3,$4); USER="  NONE  ";RATE=-1; CLID="";DNIS=""
;STOP=0; FRAMED="---"; PROTO="-"}
/User-Name/ {USER=$NF}
/Ascend-Data-Rate/ {RATE= $NF}
/Acct-Session-Time/ {SESS= $NF}
/Client-Port-DNIS/ {DNIS=$NF}
/Acct-Status-Type/ {STOP = $NF == "Stop"}
/Ascend-Disconnect-Cause/ {CAUSE = $NF}
/Ascend-PreSession-Time/ {PRESESS = $NF}
/Ascend-Connect-Progress/ {PROGR = $NF}
/Ascend-Pre-Input-Packets/ {PREIN = $NF}
/Ascend-Pre-Output-Packets/ {PREOUT = $NF}
/Caller-Id/ {CLID=$NF}
/Framed-Address/ { FRAMED = $NF}
/Framed-Protocol/ { PROTO = substr($NF,1,1)}
NF == 0          {
                  if (STOP ) {
                        print DATE, USER, RATE "\t" FRAMED PROTO "  " CAUSE ":"
PROGR "\t" PRESESS "/" PREOUT "\t" SESS "\t" DNIS "/" CLID
                  USERS[CLID]=USER;
                  USERS[DNIS]=USER;
                  STOP=0;
                }
           }
END { for (x in USERS) print USERS[x], x }'

++ Ascend Users Mailing List ++
To unsubscribe:	send unsubscribe to ascend-users-request@bungi.com
To get FAQ'd:	<http://www.nealis.net/ascend/faq>