pairs xlat

Arran Cudbard-Bell a.cudbardb at freeradius.org
Fri Sep 26 01:00:04 CEST 2014


Don't know how many people will find this useful, but I just added a pairs xlat.

It'll serialize one or more value pairs into a string.

The format is the same as pairs in the debug output, with strings being
enclosed in single quotes and separated by commas.

(0)   update  {
(0) 	control:Cleartext-Password := 'hello'
(0) 	request:Tmp-String-0 := 'This is a string'
(0) 	request:Tmp-String-0 += 'This is another one'
(0) 	request:Tmp-Octets-0 := 0x000504030201
(0) 	request:Tmp-Integer-0 := 7331
(0) 	request:Tunnel-Private-Group-Id:5 = '127.0.0.1'
(0) 	reply:Filter-Id = 'filter'
(0)   } # update  = noop

(0) EXPAND %{pairs:request:}
(0)    --> User-Name = 'bob', User-Password = 'hello', Tmp-String-0 = 'This is a string', Tmp-String-0 = 'This is another one', Tmp-Octets-0 = 0x000504030201, Tmp-Integer-0 = 7331, Tunnel-Private-Group-Id:5 = '127.0.0.1'

You can use any qualifiers or selectors you'd use in a condition or the RHS
of an update pair.

For example outer.request:Tmp-String-0[*] will get you all instances of the Tmp-String-0
attribute in the outer request.

This is useful for use in the linelog module, where you can easily construct
messages containing AVPs.

That's then intended for use with log aggregators such as Splunk, which should 
automatically parse the message into a list of attributes and values.

-Arran

Arran Cudbard-Bell <a.cudbardb at freeradius.org>
FreeRADIUS development team

FD31 3077 42EC 7FCD 32FE 5EE2 56CF 27F9 30A8 CAA2

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 881 bytes
Desc: Message signed with OpenPGP using GPGMail
URL: <http://lists.freeradius.org/pipermail/freeradius-users/attachments/20140925/387057e5/attachment.pgp>


More information about the Freeradius-Users mailing list