linelog get quoted string on demand
Arran Cudbard-Bell
a.cudbardb at freeradius.org
Fri Jun 18 21:21:35 CEST 2021
> results in
> ```
> {"Datetime": "Fri Jun 18 15:18:30 2021","Packet-Type": "Access-Request","TLS-Cert-Issuer": null}
> ```
> which is perfect. But when %{TLS-Client-Cert-Issuer} is filled it results in a not valid json file because it's not in quotes:
>
> ```
> {"Datetime": "Fri Jun 18 15:18:30 2021","Packet-Type": "Access-Request","TLS-Cert-Issuer": /O=sample/OU=sample/CN=sample}
> ```
>
> Does anyone have a idea how the contitional syntax could be used to get a quoted string when a variable is filled but a not quoted string 'null' when not?
No. you'd need to create the value outside of linelog, assign it to a temporary string, and then use that.
If you wrap the assignment and linelog call in a policy, and then call the policy instead of linelog, that'd be the cleanest way to do what you want.
-Arran
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: Message signed with OpenPGP
URL: <http://lists.freeradius.org/pipermail/freeradius-users/attachments/20210618/ade72f51/attachment.sig>
More information about the Freeradius-Users
mailing list