#
sql_user_name = "%{User-Name}"
+#######################################################################
+# Query config: Event-Timestamp
+#######################################################################
+# event_timestamp_epoch is the basis for the time inserted into
+# accounting records. Typically this will be the Event-Timestamp of the
+# accounting request, which is usually provided by a NAS.
+#
+# Uncomment the next line, if you want the timestamp to be based on the
+# request reception time recorded by this server, for example if you
+# distrust the provided Event-Timestamp.
+#event_timestamp_epoch = "%l"
+
+event_timestamp_epoch = "%{%{integer:Event-Timestamp}:-%l}"
+
+# event_timestamp is the SQL snippet for converting an epoch timestamp
+# to an SQL date.
+
+event_timestamp = "%{expr:${event_timestamp_epoch} * 1000}"
+
#######################################################################
# Default profile
#######################################################################
accounting-on {
query = "\
INSERT INTO radnasreboot (nasipaddress, timestamp) \
- VALUES ('%{NAS-IP-Address}', %{expr:%{%{integer:Event-Timestamp}:-%l}} * 1000});"
+ VALUES ('%{NAS-IP-Address}', ${....event_timestamp});"
}
accounting-off {
'%{NAS-IP-Address}', \
'%{%{NAS-Port-Id}:-%{NAS-Port}}', \
'%{NAS-Port-Type}', \
- %{expr:%{%{integer:Event-Timestamp}:-%l} * 1000}, \
- %{expr:%{%{integer:Event-Timestamp}:-%l} * 1000}, \
+ ${....event_timestamp}, \
+ ${....event_timestamp}, \
null, \
'%{Acct-Authentic}', \
'%{Connect-Info}', \
acctstarttime \
) VALUES ( \
'%{Acct-Unique-Session-Id}', \
- %{expr:(%{%{integer:Event-Timestamp}:-%l} - &Acct-Session-Time) * 1000} \
+ %{expr:(${....event_timestamp_epoch} - &Acct-Session-Time) * 1000} \
) IF NOT EXISTS; \
INSERT INTO ${....acct_table1} ( \
acctuniqueid, \
'%{NAS-IP-Address}', \
'%{%{NAS-Port-Id}:-%{NAS-Port}}', \
'%{NAS-Port-Type}', \
- %{expr:%{%{integer:Event-Timestamp}:-%l} * 1000}, \
+ ${....event_timestamp}, \
null, \
'%{Acct-Authentic}', \
'%{Connect-Info}', \
acctstarttime \
) VALUES ( \
'%{Acct-Unique-Session-Id}', \
- %{expr:(%{%{integer:Event-Timestamp}:-%l} - &Acct-Session-Time) * 1000} \
+ %{expr:(${....event_timestamp_epoch} - &Acct-Session-Time) * 1000} \
) IF NOT EXISTS; \
INSERT INTO ${....acct_table1} ( \
acctuniqueid, \
'%{NAS-IP-Address}', \
'%{%{NAS-Port-Id}:-%{NAS-Port}}', \
'%{NAS-Port-Type}', \
- %{expr:%{%{integer:Event-Timestamp}:-%l} * 1000}, \
- %{expr:%{%{integer:Event-Timestamp}:-%l} * 1000}, \
+ ${....event_timestamp}, \
+ ${....event_timestamp}, \
'%{Acct-Authentic}', \
'%{Connect-Info}', \
%{expr:(&Acct-Input-Gigawords << 32) | &Acct-Input-Octets}, \