Re: Unsure of linelog configuration

Matthew Newton via Freeradius-Users <[email protected]>
Newsgroups gmane.comp.freeradius.user
Message-ID <[email protected]>
On 31/07/2025 13:41, David Lake wrote:
> (4) dhcp_sqlippool:    --> DHCP: Allocated IP: 192.168.2.101 from ipoe 
> (cid 0x010c3311bf0000 chaddr 0c:33:11:bf:00:00 giaddr 192.168.2.1)
> (4)     [dhcp_sqlippool] = ok
> (4) linelog_dhcp: EXPAND %t %{control:Module-Success-Message}
> (4) linelog_dhcp:    --> Thu Jul 31 12:32:31 2025 DHCP: Allocated IP: 
> 192.168.2.101 from ipoe (cid 0x010c3311bf0000 chaddr 0c:33:11:bf:00:00 
> giaddr 192.168.2.1)


Ah, OK. dhcp_sqlippool calls the authorize method, which emits some 
logging information that ends up in Module-Success-Message.


> After an ACK I see this:
> 
> (5) dhcp_sqlippool:    --> UPDATE dhcpippool SET expiry_time = NOW() + 
> INTERVAL 7200 SECOND, counter = counter + 1 WHERE pool_name = 'ipoe' AND 
> pool_key = '0x010c3311bf0000' AND framedipaddress = '192.168.2.101'
> (5) dhcp_sqlippool: Executing query: UPDATE dhcpippool SET expiry_time = 
> NOW() + INTERVAL 7200 SECOND, counter = counter + 1 WHERE pool_name = 
> 'ipoe' AND pool_key = '0x010c3311bf0000' AND framedipaddress = 
> '192.168.2.101'
> rlm_sql_mysql: Rows matched: 1  Changed: 1  Warnings: 0
...

> (5) linelog_dhcp: EXPAND %t %{control:Module-Success-Message}
> (5) linelog_dhcp:    --> Thu Jul 31 12:32:32 2025

dhcp_sqlippool_request calls the accounting method, which doesn't output 
any logging, so doesn't update the Module-Success-Message attribute.

You'll be better to just log what you want, rather than using that 
attribute. Something like

   message="%t %{request:DHCP-Client-Hardware-Address} 
%{reply:DHCP-Your-IP-Address} from pool %{Pool-Name}"

Add whatever attributes you need (you can call the `debug_all` policy 
before `linelog_dhcp` to show them all in the debug output if you're not 
sure what is available).

-- 
Matthew
-
List info/subscribe/unsubscribe? See http://www.freeradius.org/list/users.html
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.