Hi, I've been recently faced with a crappy NAS that didn't properly support sending GigaWord and would just wrap the Acct-{Input,Output}-Octets after 4G, but I still wanted to record the proper value. My work around was to use a custom SQL function : CREATE OR REPLACE FUNCTION BYTE_UPDATE(bigint, bigint) RETURNS bigint AS 'SELECT CASE WHEN $1 IS NULL OR $2 IS NULL THEN COALESCE($1,$2) WHEN $2 >= (1::bigint << 32) THEN $2 WHEN $2 < ($1 & ((1::bigint << 32) - 1)) THEN ((($1 & ~((1::bigint << 32) - 1)) | $2) + (1::bigint << 32)) ELSE (($1 & ~((1::bigint << 32) - 1)) | $2) END;' LANGUAGE SQL IMMUTABLE; And in queries.conf, change to call it using old_value, new_value as argument : AcctInputOctets = BYTE_UPDATE(AcctInputOctets, (('%{%{Acct-Input-Gigawords}:-0}'::bigint << 32) + '%{%{Acct-Input-Octets}:-0}'::bigint)), The function basically just detects wrap around and assumes that the 4G point was reached and increments value appropriately. If your NAS properly sends Gigawords, then the function does nothing. I've been running this on postgres for a while now and it seems to work nicely. I just thought I'd share that here in case someone else had the same issue ... Cheers, Sylvain
participants (1)
-
Sylvain Munaut