Guest

Cisco Access Registrar

CAR 5.x Accounting File Generation Procedure for CSV Format

Document ID: 116426

Updated: Sep 26, 2013

Contributed by Calvin Ryver, Cisco TAC Engineer.

   Print

Introduction

This document describes how to manually edit the RexAcctScript so that your accounting log files reflect a Comma Separated Values (CSV) format.

Edit the RexAcct Script

The VerifylibRexAcctScript.so file is located in the cisco-ar > scripts > radius > rex directory. 

Note: In order to configure the log files to use the CSV format, you must manually edit and recompile the script. This procedure is documented in the Using the REX Accounting Script User Guide, Chapter 25.

In order to change the format of the accounting file, navigate to opt > AICar1 > examples > rexacctscript > AcctAsScript.cpp, and make these changes:

Line Number             From                         To
2048              *(pEnd++) = "\n";           *(pEnd++) = ",";
2037              *(pEnd++) = "\t";           *(pEnd++) = " ";

Note: The quotation marks ("  ")  contain a space.

You might receive an error message such as this:

AcctAsScript.cpp:2080:18: error: empty character constant

If you receive this error message, then check the AcctAsScript.cpp file for a string and value that matches this:

*(pEnd++) = '';

Modify the script to look like this:

*(pEnd++) = '\t

The accounting file output should now resemble this:

Tue,  26  Sep  2000  17:15:22
User?Name = sven, NAS?IP?Address = 10.200.68.2, NAS?Port = 2,
Service?Type = NAS Prompt, Calling?Station?Id = 172.17.246.244,
Acct?Status?Type = Start, Acct?Delay?Time = 0,
Acct?Session?Id = 0000000D, Acct?Authentic = RADIUS,
NAS?Port?Type = Virtual,,,,, Tue, 26 Sep 2000 17:15:23
User?Name = sven, NAS?IP?Address = 10.200.68.2, NAS?Port = 2,
Service?Type = NAS Prompt, Calling?Station?Id = 172.17.246.244,
Acct?Status?Type = Stop,Acct?Delay?Time = 0, Acct?Session?Id = 0000000D,
Acct?Authentic = RADIUS, Acct?Session?Time = 1,
Acct?Terminate?Cause = User Request, NAS?Port?Type = Virtual,,,,,

If you see commas separate the entries, then you are now set to use CSV format. 

Note: You are not required to use a group service; the LocalAccounting script configured through ServerIncomingScript writes the accounting records, and the configured DefaultAccountingService proxies the accounting requests.

Related Information

Updated: Sep 26, 2013
Document ID: 116426