Update to documentation for the module subgrouping selection attributes.
[freeradius.git] / doc / Acct-Type
1 FreeRADIUS supports the Acct-Type attribute to select between
2 accounting methods based on arbitrary attribute/value pairs contained
3 in an accounting packet. Its use follows the same general configuration
4 syntax as Auth-Type and Autz-Type. The main difference in configuration
5 between Acct-Type and Auth/Autz-Type lies in where the Acct-Type
6 method is assigned. With Auth/Autz-Type, the method is typically
7 assigned in the 'users' file. The 'users' file, naturally, is not
8 processed during the handling of the accounting {} section. However,
9 part of the default files {} module is the 'acct_users' file, which
10 serves the same purpose as the 'users' file, but applies to accounting
11 packets.
12
13 Like Autz-Type, if a module changes Acct-Type, after the current
14 selection of modules has been run, the section is reexamined for
15 a subsection matching the new Acct-Type.
16
17 For example, a server administrator is responsible for handling the
18 accounting data for two different realms, foo.com and bar.com, and
19 wishes to use different instances of the SQL module for each. In
20 addition, there is one RADIUS client sending accounting data that is
21 to be logged only to a specific detail file. Everything else should
22 use a third SQL instance.
23
24
25 The acct_users file would look something like this:
26
27 ---
28 DEFAULT Realm == "foo.com", Acct-Type := "SQLFOO"
29
30 DEFAULT Realm == "bar.com", Acct-Type := "SQLBAR"
31
32 DEFAULT Client-IP-Address == "10.0.0.1", Acct-Type := "OTHERNAS"
33 ---
34
35 And in radiusd.conf:
36 ---
37 $INCLUDE  ${confdir}/sql0.conf # Instance named 'sql0'.
38 $INCLUDE  ${confdir}/sql1.conf # Instance named 'sql1'.
39 $INCLUDE  ${confdir}/sql2.conf # Instance named 'sql2'.
40
41 detail othernas {
42         detailfile = ${radacctdir}/10.0.0.1/detail-%Y%m%d
43 }
44
45 preacct {
46         suffix # Add the Realm A/V pair.
47         files  # Add the Acct-Type A/V pair based on the Realm A/V pair.
48 }
49
50 accounting {
51
52         # If Acct-Type is SQLFOO use the 'sql1' instance of the SQL module.
53
54         Acct-Type SQLFOO {
55                 sql1
56         }
57
58         # If Acct-Type is SQLBAR, use the 'sql2' instance of the SQL module.
59
60         Acct-Type SQLBAR {
61                 sql2
62         }
63
64         # If Acct-Type is OTHERNAS, use the 'othernas' instance of the detail
65         # module
66
67         Acct-Type OTHERNAS {
68                 othernas
69         }
70
71         # If we've made it this far, we haven't matched an Acct-Type, so use
72         # the sql0 instance.
73
74         sql0
75 }
76 ---