Hi Alan, thank you for the valuable comments. I want to split the Acct-Session-Id attribute from account stop request at the "/" sign and write the two resulting parts in to two separate columns in a MySQL DB. My limited understanding of the way to approach it is have something like a local variable defined that would take the results of the explode operations and then use this new variable to write the splited content in two columns in a MySQL DB. From your comment I seem to get that there is no concept of something like local variables in FreeRADIUS that can be freely defined and operated upon. I would need to have attributes defined within the dictionary that would act as the variables that I need. As for MySQL queries I have a custom file with mapping from proprietary accounting attributed that I've created and it is working fine. I just never used attributes with multiple values, but used attributed with multiple tags and wrongly derived the syntax from that experience. Will adjust accordingly. It was a typo with % inside {} Given the explanation would it be the right way to proceed? * Defining a new attribute in raddb/dictionary that would hold the results of the splitting. * Add update request section to preacct: preacct{ update request { Split-Session-ID = "%{explode:%{Acct-Session-Id} /}" } } * in MySQL driver-specific configuration use: '%{Split-Session-ID[1]}', \ '%{Split-Session-ID[2]}', \ Thanks, Xaled -----Original Message----- From: Freeradius-Users <freeradius-users-bounces+xaled=web.de@lists.freeradius.org> On Behalf Of Alan DeKok Sent: Monday, February 14, 2022 5:50 PM To: FreeRadius users mailing list <freeradius-users@lists.freeradius.org> Subject: Re: split an accounting attribute in two and write two new attributes to MySQL On Feb 14, 2022, at 11:40 AM, <xaled@web.de> <xaled@web.de> wrote:
In preacct section of default config from sites enabled I added
Split-Session-ID = "%{explode:%{Acct-Session-Id} /}"
You can't just add random things to the configuration files. Any attribute editing as to go into an "update" section. The documentation shows this, and there are many examples of it in the configuration files.
And immediately get error:
/etc/freeradius/3.0/sites-enabled/default[558]: Unknown action '%{explode:%{Acct-Session-Id}/}'.
This only happens if the attribute editing it's in an "update" section.
In mysql mapping config I added
I don't know what "mysql mapping config" is. Perhaps give the filename?
'{%Split-Session-ID:1}', \
'{%Split-Session-ID:2}', \
That won't do what you want, either. I think you're trying to access multiple values of the "Split-Session-ID" attribute? But you're not saying, so I can only guess. And the expansion syntax you're using is completely wrong. See the documentation for how to reference multiple values of one attribute. It's normal array offset syntax, using [0], [1], etc. See the documentation for the expansion syntax... it's %{Name}. Not {%nName} You also need to define the Split-Session-Id attribute in raddb/dictionary. I suspect that you haven't done that. You can't just edit the MySQL queries to add new fields. The SQL queries put values in specific columns, which have pre-defined meanings. And it helps to *explain* what you're doing. Give details. The less information you give, the harder it is to help you. Alan DeKok. - List info/subscribe/unsubscribe? See http://www.freeradius.org/list/users.html