forked from Skatterbrainz/CMWT
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcmwtlogs.asp
85 lines (74 loc) · 2.79 KB
/
cmwtlogs.asp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
<!-- #include file=_core.asp -->
<%
'-----------------------------------------------------------------------------
' filename....... cmwtlogs.asp
' lastupdate..... 12/03/2016
' description.... cmwt database log maintenance
'-----------------------------------------------------------------------------
time1 = Timer
QueryOn = CMWT_GET("qq", "")
PageTitle = "CMWT Database Logs"
PageBackLink = "admin.asp"
PageBackName = "Administration"
CMWT_NewPage "", "", ""
%>
<!-- #include file="_sm.asp" -->
<!-- #include file="_banner.asp" -->
<%
if Application("CMWT_ENABLE_LOGGING") = "TRUE" Then
query1 = "SELECT 'Task records' AS Description, COUNT(*) AS RECS " & _
"FROM dbo.Tasks " & _
"UNION " & _
"SELECT 'Task records completed' AS Description, COUNT(*) AS RECS " & _
"FROM dbo.Tasks " & _
"WHERE DateTimeExecuted IS NOT NULL " & _
"UNION " & _
"SELECT 'Task records pending execution' AS Description, COUNT(*) AS RECS " & _
"FROM dbo.Tasks " & _
"WHERE DateTimeExecuted IS NULL " & _
"UNION " & _
"SELECT 'Task records older than " & Application("CMWT_MAX_LOG_AGE_DAYS") & _
" days' AS Description, COUNT(*) AS RECS " & _
"FROM dbo.Tasks " & _
"WHERE DateTimeCreated < GETDATE() - " & Application("CMWT_MAX_LOG_AGE_DAYS")
query2 = "SELECT 'Event log records' AS Description, COUNT(*) AS RECS " & _
"FROM dbo.EventLog " & _
"UNION " & _
"SELECT 'Event log records, type INFO' AS Description, COUNT(*) AS RECS " & _
"FROM dbo.EventLog " & _
"WHERE EventType = 'INFO' " & _
"UNION " & _
"SELECT 'Event log records, type ERROR' AS Description, COUNT(*) AS RECS " & _
"FROM dbo.EventLog " & _
"WHERE EventType = 'ERROR' " & _
"UNION " & _
"SELECT 'Event log records older than " & Application("CMWT_MAX_LOG_AGE_DAYS") & _
" days' AS Description, COUNT(*) AS RECS " & _
"FROM dbo.EventLog " & _
"WHERE EventDateTime < GETDATE() - " & Application("CMWT_MAX_LOG_AGE_DAYS")
query3 = "SELECT DISTINCT EventCategory, COUNT(*) AS QTY " & _
"FROM dbo.EventLog " & _
"GROUP BY EventCategory"
Dim conn, cmd, rs
CMWT_DB_QUERY Application("DSN_CMWT"), query1
CMWT_DB_TABLEGRID rs, "", "", ""
CMWT_DB_CLOSE()
Response.Write "<br/>"
CMWT_DB_QUERY Application("DSN_CMWT"), query2
CMWT_DB_TABLEGRID rs, "", "", ""
CMWT_DB_CLOSE()
Response.Write "<br/>"
CMWT_DB_QUERY Application("DSN_CMWT"), query3
CMWT_DB_TABLEGRID rs, "", "", ""
CMWT_DB_CLOSE()
Else
Response.Write "<table class=""tfx""><tr class=""h200 tr1"">" & _
"<td class=""td6 ctr v10"">Logging is not enabled.<p>" & _
"To enable site activity logging, modify the _config.txt file " & _
"to set CMWT_ENABLE_LOGGING~TRUE</p><p>Then recycle the IIS application pool.</p>" & _
"</td></tr></table>"
End If
CMWT_Footer()
%>
</body>
</html>