freeradius accounting of cdr and quotes for string attributes
My question is this, I need to write CDR information out using the linelog module in csv format. The requirement is that all string attributes need to be enclosed in double quotes. How does one go about doing this? If you look at the detailed format, these string attributes are enclosed. But there seems to be no option in linelog module. I am using freeradius v2.1.10. Thanks for any help Kelly
On Tue, Feb 05, 2013 at 05:18:13PM +0000, Kelly Roestel wrote:
If you look at the detailed format, these string attributes are enclosed. But there seems to be no option in linelog module.
linelog { ... format = "\"%{Client-IP-Address}\",\"%{Calling-Station-Id}\",\"%{User-Name}\"" ... } Matthew -- Matthew Newton, Ph.D. <mcn4@le.ac.uk> Systems Specialist, Infrastructure Services, I.T. Services, University of Leicester, Leicester LE1 7RH, United Kingdom For IT help contact helpdesk extn. 2253, <ithelp@le.ac.uk>
Matthew, Yes that works. However, if the attribute is empty there will still be quotes in the csv file. Example. using format = "\"%{Client-IP-Address}\",\"%{Calling-Station-Id}\",\"%{User-Name}\"" would yield, "x.x.x.x","station-x","Kelly" if %{Calling-Station-Id} was null this format would yield. "x.x.x.x","","Kelly". I would like to have blank attribute not insert quotes. So my desired format would be "x.x.x.x",,"Kelly" Thank for the help so far. Kelly
Kelly Roestel wrote:
Yes that works. However, if the attribute is empty there will still be quotes in the csv file.
If you want generic string manipulation code, use a real programming language. Or, write a "csv" module to do what you want. The linelog module is intended to write *lines of text*. That is, strings. It is *not* intended to write carefully formatted CSV files. It cannot be made to that, as CSV files are not simple text strings. Alan DeKok.
Alan, Thank you for the info. Kelly 206.331.3525o 425.270.8481c On Wed 06 Feb 2013 11:41:42 AM PST, Alan DeKok wrote:
participants (3)
-
Alan DeKok -
Kelly Roestel -
Matthew Newton