Advertisement
Guest User

Untitled

a guest
Jul 21st, 2017
278
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.10 KB | None | 0 0
  1. accounting {
  2. reference = "%{tolower:type.%{Acct-Status-Type}.query}"
  3. column_list = "\
  4. acctsessionid, acctuniqueid, username, groupname, \
  5. realm, nasipaddress, nasportid, \
  6. nasporttype, acctstarttime, acctupdatetime, \
  7. acctstoptime, acctsessiontime, acctauthentic, \
  8. connectinfo_start, connectinfo_stop, acctinputoctets, \
  9. acctoutputoctets, calledstationid, callingstationid, \
  10. acctterminatecause, servicetype, framedprotocol, \
  11. framedipaddress"
  12. type {
  13. accounting-on {
  14. query = "\
  15. UPDATE ${....acct_table1} \
  16. SET \
  17. acctstoptime = FROM_UNIXTIME(\
  18. %{integer:Event-Timestamp}), \
  19. acctsessiontime = '%{integer:Event-Timestamp}' \
  20. - UNIX_TIMESTAMP(acctstarttime), \
  21. acctterminatecause = '%{%{Acct-Terminate-Cause}:-NAS-Reboot}' \
  22. WHERE acctstoptime IS NULL \
  23. AND nasipaddress = '%{NAS-IP-Address}' \
  24. AND acctstarttime <= FROM_UNIXTIME(\
  25. %{integer:Event-Timestamp})"
  26. }
  27. accounting-off {
  28. query = "${..accounting-on.query}"
  29. }
  30. start {
  31. query = "\
  32. INSERT INTO ${....acct_table1} \
  33. (${...column_list}) \
  34. VALUES \
  35. ('%{Acct-Session-Id}', \
  36. '%{Acct-Unique-Session-Id}', \
  37. '%{SQL-User-Name}', \
  38. '%{SQL-Group}', \
  39. '%{Realm}', \
  40. '%{NAS-IP-Address}', \
  41. '%{%{NAS-Port-ID}:-%{NAS-Port}}', \
  42. '%{NAS-Port-Type}', \
  43. FROM_UNIXTIME(%{integer:Event-Timestamp}), \
  44. FROM_UNIXTIME(%{integer:Event-Timestamp}), \
  45. NULL, \
  46. '0', \
  47. '%{Acct-Authentic}', \
  48. '%{Connect-Info}', \
  49. '', \
  50. '0', \
  51. '0', \
  52. '%{Called-Station-Id}', \
  53. '%{Calling-Station-Id}', \
  54. '', \
  55. '%{Service-Type}', \
  56. '%{Framed-Protocol}', \
  57. '%{Framed-IP-Address}')"
  58. query = "\
  59. UPDATE ${....acct_table1} SET \
  60. acctstarttime = FROM_UNIXTIME(%{integer:Event-Timestamp}), \
  61. acctupdatetime = FROM_UNIXTIME(%{integer:Event-Timestamp}), \
  62. connectinfo_start = '%{Connect-Info}' \
  63. WHERE AcctUniqueId = '%{Acct-Unique-Session-Id}'"
  64. }
  65. interim-update {
  66. query = "\
  67. UPDATE ${....acct_table1} \
  68. SET \
  69. acctupdatetime = (@acctupdatetime_old:=acctupdatetime), \
  70. acctupdatetime = FROM_UNIXTIME(\
  71. %{integer:Event-Timestamp}), \
  72. acctinterval = %{integer:Event-Timestamp} - \
  73. UNIX_TIMESTAMP(@acctupdatetime_old), \
  74. framedipaddress = '%{Framed-IP-Address}', \
  75. acctsessiontime = %{%{Acct-Session-Time}:-NULL}, \
  76. acctinputoctets = '%{%{Acct-Input-Gigawords}:-0}' \
  77. << 32 | '%{%{Acct-Input-Octets}:-0}', \
  78. acctoutputoctets = '%{%{Acct-Output-Gigawords}:-0}' \
  79. << 32 | '%{%{Acct-Output-Octets}:-0}' \
  80. WHERE AcctUniqueId = '%{Acct-Unique-Session-Id}'"
  81. query = "\
  82. INSERT INTO ${....acct_table1} \
  83. (${...column_list}) \
  84. VALUES \
  85. ('%{Acct-Session-Id}', \
  86. '%{Acct-Unique-Session-Id}', \
  87. '%{SQL-User-Name}', \
  88. '%{SQL-Group}', \
  89. '%{Realm}', \
  90. '%{NAS-IP-Address}', \
  91. '%{%{NAS-Port-ID}:-%{NAS-Port}}', \
  92. '%{NAS-Port-Type}', \
  93. FROM_UNIXTIME(%{integer:Event-Timestamp} - %{%{Acct-Session-Time}:-0}), \
  94. FROM_UNIXTIME(%{integer:Event-Timestamp}), \
  95. NULL, \
  96. %{%{Acct-Session-Time}:-NULL}, \
  97. '%{Acct-Authentic}', \
  98. '%{Connect-Info}', \
  99. '', \
  100. '%{%{Acct-Input-Gigawords}:-0}' << 32 | '%{%{Acct-Input-Octets}:-0}', \
  101. '%{%{Acct-Output-Gigawords}:-0}' << 32 | '%{%{Acct-Output-Octets}:-0}', \
  102. '%{Called-Station-Id}', \
  103. '%{Calling-Station-Id}', \
  104. '', \
  105. '%{Service-Type}', \
  106. '%{Framed-Protocol}', \
  107. '%{Framed-IP-Address}')"
  108. }
  109. stop {
  110. query = "\
  111. UPDATE ${....acct_table2} SET \
  112. acctstoptime = FROM_UNIXTIME(\
  113. %{integer:Event-Timestamp}), \
  114. acctsessiontime = %{%{Acct-Session-Time}:-NULL}, \
  115. acctinputoctets = '%{%{Acct-Input-Gigawords}:-0}' \
  116. << 32 | '%{%{Acct-Input-Octets}:-0}', \
  117. acctoutputoctets = '%{%{Acct-Output-Gigawords}:-0}' \
  118. << 32 | '%{%{Acct-Output-Octets}:-0}', \
  119. acctterminatecause = '%{Acct-Terminate-Cause}', \
  120. connectinfo_stop = '%{Connect-Info}' \
  121. WHERE AcctUniqueId = '%{Acct-Unique-Session-Id}'"
  122. query = "\
  123. INSERT INTO ${....acct_table2} \
  124. (${...column_list}) \
  125. VALUES \
  126. ('%{Acct-Session-Id}', \
  127. '%{Acct-Unique-Session-Id}', \
  128. '%{SQL-User-Name}', \
  129. '%{SQL-Group}', \
  130. '%{Realm}', \
  131. '%{NAS-IP-Address}', \
  132. '%{%{NAS-Port-ID}:-%{NAS-Port}}', \
  133. '%{NAS-Port-Type}', \
  134. FROM_UNIXTIME(%{integer:Event-Timestamp} - %{%{Acct-Session-Time}:-0}), \
  135. FROM_UNIXTIME(%{integer:Event-Timestamp}), \
  136. FROM_UNIXTIME(%{integer:Event-Timestamp}), \
  137. %{%{Acct-Session-Time}:-NULL}, \
  138. '%{Acct-Authentic}', \
  139. '', \
  140. '%{Connect-Info}', \
  141. '%{%{Acct-Input-Gigawords}:-0}' << 32 | '%{%{Acct-Input-Octets}:-0}', \
  142. '%{%{Acct-Output-Gigawords}:-0}' << 32 | '%{%{Acct-Output-Octets}:-0}', \
  143. '%{Called-Station-Id}', \
  144. '%{Calling-Station-Id}', \
  145. '%{Acct-Terminate-Cause}', \
  146. '%{Service-Type}', \
  147. '%{Framed-Protocol}', \
  148. '%{Framed-IP-Address}')"
  149. }
  150. }
  151. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement