backslash and expansion variable quirk in line log format string
Hi Everyone, I am doing some radius sysloging via the linelog module for accounting requests which is working well except for a string format quirk - my module config is below. I'm trying to get the logged message to be in the format of foo\<username> where foo is only relevant to the device reading the syslog messages and is not a radius login realm. However, foo\\%{User-Name} results in a logged message of "foo\%{User-name}" instead of "foo\fred" - the \% is being interpreted as a control code. If there is any character between the '\' and the '%' it works correctly and logs "foo\fred". Is there any string format configuration that will result in 'foo\fred' being logged - using %{User-Name} - without an inserted space/char in the middle ? I don't seem to be able to find a format that works. ie %{User-Name} is "fred" "foo\\%{User-Name}", logs "foo\%{User-Name}" to syslog "foo\\ %{User-Name}" - space between '\' and '%' - logs "foo\ fred" to syslog, with a space in the string Module config: linelog SyslogAccountingtoPaloAlto { filename = "syslog" format = "This is a log message for %{User-Name}" reference = "Accounting-Request.%{%{Acct-Status-Type}:-unknown}" Access-Request = "Requested access: %{User-Name}" Access-Reject = "Rejected access: %{User-Name}" Access-Challenge = "Sent challenge: %{User-Name}" foo { bar = "Example log. Please ignore" } Accounting-Request { Start = "Radius Acct Start: Username:%{User-Name}" Stop = "Radius Acct Stop: Username:%{User-Name}" Interim-Update = "Radius Interim-Update: Username:foo\\%{User-Name}" # Don't log anything for these packets. Alive = "" Accounting-On = "" Accounting-Off = "" # don't log anything for other Acct-Status-Types. unknown = "" } } Thanks heaps Jason Rankin
-----Original Message----- From: Freeradius-Users [mailto:freeradius-users- bounces+j.rankin=federation.edu.au@lists.freeradius.org] On Behalf Of A.L.M.Buxey@lboro.ac.uk Sent: Friday, 10 April 2015 5:35 PM To: FreeRadius users mailing list Subject: Re: backslash and expansion variable quirk in line log format string
Hi,
ie %{User-Name} is "fred" "foo\\%{User-Name}", logs "foo\%{User-Name}" to syslog
"foo\%{User-Name}" ?
alan - List info/subscribe/unsubscribe? See http://www.freeradius.org/list/users.html
Hi Alan, if I use a single '\' , I seem to get "foofred", where %{User-Name} = "fred". It's got something to do with the string parsing and single \ characters as control chars, but I've missed something... thanks Jason
Hi Alan, Thanks heaps, that worked. I’d tried double and triple, but not four, which makes sense in hindsight. I forgot to mention that I’m using v 2.2.6 Thanks Jason Rankin Senior Network Administrator | Information Technology Services Federation University Australia PO Box 663 Ballarat VIC 3353 Telephone +61 (03) 5327 9782 | Mobile 0417 595 045 j.rankin@federation.edu.au CRICOS Provider Number 00103D [http://federation.edu.au/__data/assets/image/0005/148361/eMail-Signature_150...] From: Alan Buxey [mailto:A.L.M.Buxey@lboro.ac.uk] Sent: Friday, 10 April 2015 11:04 PM To: FreeRadius users mailing list; Jason Rankin Subject: RE: backslash and expansion variable quirk in line log format string Sounds like you need \\\\ version 2.2.x needs backslash overload alan
ie %{User-Name} is "fred" "foo\\%{User-Name}", logs "foo\%{User-Name}" to syslog "foo\\ %{User-Name}" - space between '\' and '%' - logs "foo\ fred" to syslog, with a space in the string
Jason, you don't mention which version of FreeRADIUS you are using? With v3.0.7 and later, Alan B's suggestion to just use a \ should be ok. Stefan Paetow Moonshot Industry & Research Liaison Coordinator t: +44 (0)1235 822 125 gpg: 0x3FCE5142 xmpp: stefanp@jabber.dev.ja.net skype: stefan.paetow.janet jisc.ac.uk Jisc is a registered charity (number 1149740) and a company limited by guarantee which is registered in England under Company No. 5747339, VAT No. GB 197 0632 86. Jisc¹s registered office is: One Castlepark, Tower Hill, Bristol, BS2 0JA. T 0203 697 5800. Jisc Collections and Janet Ltd. is a wholly owned Jisc subsidiary and a company limited by guarantee which is registered in England under Company No. number 2881024, VAT No. GB 197 0632 86. The registered office is: Lumen House, Library Avenue, Harwell, Didcot, Oxfordshire, OX11 0SG. T 01235 822200.
participants (4)
-
A.L.M.Buxey@lboro.ac.uk -
Alan Buxey -
Jason Rankin -
Stefan Paetow