audit-policy.jsp 10.4 KB
Newer Older
Bill Lynch's avatar
Bill Lynch committed
1
<%--
Matt Tucker's avatar
Matt Tucker committed
2 3 4
  -	$RCSfile$
  -	$Revision$
  -	$Date$
Bill Lynch's avatar
Bill Lynch committed
5 6 7 8 9
  -
  - Copyright (C) 2004 Jive Software. All rights reserved.
  -
  - This software is published under the terms of the GNU Public License (GPL),
  - a copy of which is included in this distribution.
Matt Tucker's avatar
Matt Tucker committed
10
--%>
Bill Lynch's avatar
Bill Lynch committed
11 12

<%@ page import="org.jivesoftware.messenger.audit.AuditManager,
Derek DeMoro's avatar
Derek DeMoro committed
13 14
                   org.jivesoftware.admin.*,
                   org.jivesoftware.util.*,
Bill Lynch's avatar
Bill Lynch committed
15 16 17 18
                   java.util.*"
    errorPage="error.jsp"
%>

19
<%@ taglib uri="http://java.sun.com/jstl/fmt_rt" prefix="fmt" %>
Bill Lynch's avatar
Bill Lynch committed
20

Matt Tucker's avatar
Matt Tucker committed
21 22 23
<jsp:useBean id="admin" class="org.jivesoftware.util.WebManager"  />
<% admin.init(request, response, session, application, out ); %>

Derek DeMoro's avatar
Derek DeMoro committed
24 25 26 27
<jsp:useBean id="pageinfo" scope="request" class="org.jivesoftware.admin.AdminPageBean" />
<%  // Title of this page and breadcrumbs
    String title = "Audit Policy";
    pageinfo.setTitle(title);
Bill Lynch's avatar
Bill Lynch committed
28
    pageinfo.getBreadcrumbs().add(new AdminPageBean.Breadcrumb("Main", "index.jsp"));
Derek DeMoro's avatar
Derek DeMoro committed
29 30 31
    pageinfo.getBreadcrumbs().add(new AdminPageBean.Breadcrumb(title, "audit-policy.jsp"));
    pageinfo.setPageID("server-audit-policy");
%>
Bill Lynch's avatar
Bill Lynch committed
32
<jsp:include page="top.jsp" flush="true" />
Derek DeMoro's avatar
Derek DeMoro committed
33 34
<jsp:include page="title.jsp" flush="true" />

Bill Lynch's avatar
Bill Lynch committed
35
<%   // Get parameters:
Matt Tucker's avatar
Matt Tucker committed
36 37 38 39 40 41 42 43 44 45
    boolean update = request.getParameter("update") != null;
    boolean auditEnabled = ParamUtils.getBooleanParameter(request,"auditEnabled");
    boolean auditMessages = ParamUtils.getBooleanParameter(request,"auditMessages");
    boolean auditPresence = ParamUtils.getBooleanParameter(request,"auditPresence");
    boolean auditIQ = ParamUtils.getBooleanParameter(request,"auditIQ");
    boolean auditXPath = ParamUtils.getBooleanParameter(request,"auditXPath");
    String newXpathQuery = ParamUtils.getParameter(request,"newXpathQuery");
    String[] xpathQuery = ParamUtils.getParameters(request,"xpathQuery");
    String maxCount = ParamUtils.getParameter(request,"maxCount");
    String maxSize = ParamUtils.getParameter(request,"maxSize");
46
    String logTimeout = ParamUtils.getParameter(request,"logTimeout");
Matt Tucker's avatar
Matt Tucker committed
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

    // Get an audit manager:
    AuditManager auditManager = (AuditManager)admin.getServiceLookup().lookup(AuditManager.class);

    Map errors = new HashMap();
    if (update) {
        auditManager.setEnabled(auditEnabled);
        auditManager.setAuditMessage(auditMessages);
        auditManager.setAuditPresence(auditPresence);
        auditManager.setAuditIQ(auditIQ);
        /*
        auditManager.setAuditXPath(auditXPath);
        if (newXpathQuery != null) {
            auditManager.addXPath(newXpathQuery);
        }
        for (int i=0; i<xpathQuery.length; i++) {
            auditManager.removeXPath(xpathQuery[i]);
        }
        */
        try {
            auditManager.setMaxFileCount(Integer.parseInt(maxCount));
        } catch (Exception e){
            errors.put("maxCount","maxCount");
        }
        try {
            auditManager.setMaxFileSize(Integer.parseInt(maxSize));
        } catch (Exception e){
            errors.put("maxSize","maxSize");
        }
76 77 78 79 80
        try {
            auditManager.setLogTimeout(Integer.parseInt(logTimeout) * 1000);
        } catch (Exception e){
            errors.put("logTimeout","logTimeout");
        }
Matt Tucker's avatar
Matt Tucker committed
81 82 83
        // All done, redirect
        if (errors.size() == 0){
        %>
Bill Lynch's avatar
Bill Lynch committed
84 85 86 87 88 89 90 91 92 93 94 95

    <div class="jive-success">
    <table cellpadding="0" cellspacing="0" border="0">
    <tbody>
        <tr><td class="jive-icon"><img src="images/success-16x16.gif" width="16" height="16" border="0"></td>
        <td class="jive-icon-label">
        Settings updated successfully.
        </td></tr>
    </tbody>
    </table>
    </div><br>

Matt Tucker's avatar
Matt Tucker committed
96 97 98 99 100 101 102 103 104 105 106 107 108
        <%
        }
    }

    // Set page vars
    if (errors.size() == 0) {
        auditEnabled = auditManager.isEnabled();
        auditMessages = auditManager.isAuditMessage();
        auditPresence = auditManager.isAuditPresence();
        auditIQ = auditManager.isAuditIQ();
        auditXPath = auditManager.isAuditXPath();
        maxCount = Integer.toString(auditManager.getMaxFileCount());
        maxSize = Integer.toString(auditManager.getMaxFileSize());
109
        logTimeout = Integer.toString(auditManager.getLogTimeout() / 1000);
Matt Tucker's avatar
Matt Tucker committed
110 111 112
    }
%>

Bill Lynch's avatar
Bill Lynch committed
113
<p>
114 115
<fmt:message key="title" />
can audit XMPP traffic on the server and save
Bill Lynch's avatar
Bill Lynch committed
116
the data to XML data files. The amount of data sent via an XMPP server can be substantial.
Matt Tucker's avatar
Matt Tucker committed
117 118 119 120
Messenger provides several settings to control whether to audit packets, how
audit files are created, and the types of packets to save. In most cases, logging
Message packets will provide all of the data an enterprise requires. Presence
and IQ packets are primarily useful for tracing and troubleshooting XMPP deployments.
Bill Lynch's avatar
Bill Lynch committed
121
</p>
Matt Tucker's avatar
Matt Tucker committed
122

Bill Lynch's avatar
Bill Lynch committed
123
<form action="audit-policy.jsp">
Matt Tucker's avatar
Matt Tucker committed
124

Bill Lynch's avatar
Bill Lynch committed
125 126 127 128 129
<fieldset>
    <legend>Set Message Audit Policy</legend>
    <div>
    <table cellpadding="3" cellspacing="0" border="0" width="100%">
    <tbody>
Matt Tucker's avatar
Matt Tucker committed
130 131
        <tr valign="top">
            <td width="1%" nowrap>
Bill Lynch's avatar
Bill Lynch committed
132 133
                <input type="radio" name="auditEnabled" value="false" id="rb01"
                 <%= (!auditEnabled ? "checked" : "") %>>
Matt Tucker's avatar
Matt Tucker committed
134 135
            </td>
            <td width="99%">
Bill Lynch's avatar
Bill Lynch committed
136 137
                <label for="rb01">
                <b>Disable Message Auditing</b> - Packets are not logged.
Matt Tucker's avatar
Matt Tucker committed
138 139 140 141 142
                </label>
            </td>
        </tr>
        <tr valign="top">
            <td width="1%" nowrap>
Bill Lynch's avatar
Bill Lynch committed
143 144
                <input type="radio" name="auditEnabled" value="true" id="rb02"
                 <%= (auditEnabled ? "checked" : "") %>>
Matt Tucker's avatar
Matt Tucker committed
145 146
            </td>
            <td width="99%">
Bill Lynch's avatar
Bill Lynch committed
147 148
                <label for="rb02">
                <b>Enable Message Auditing</b> - Packets are logged with the following options:
Matt Tucker's avatar
Matt Tucker committed
149 150 151 152 153 154 155 156
                </label>
            </td>
        </tr>
        <tr valign="top">
            <td width="1%" nowrap>
                &nbsp;
            </td>
            <td width="99%">
Bill Lynch's avatar
Bill Lynch committed
157 158 159 160
                <table cellpadding="3" cellspacing="0" border="0" width="100%">
                <tr valign="top">
                    <td width="1%" nowrap class="c1">
                        Maximum file size (MB):
Matt Tucker's avatar
Matt Tucker committed
161
                    </td>
Bill Lynch's avatar
Bill Lynch committed
162 163 164
                    <td width="99%">
                        <input type="text" size="15" maxlength="50" name="maxSize"
                         value="<%= ((maxSize != null) ? maxSize : "") %>">
Matt Tucker's avatar
Matt Tucker committed
165

Bill Lynch's avatar
Bill Lynch committed
166
                    <%  if (errors.get("maxSize") != null) { %>
Matt Tucker's avatar
Matt Tucker committed
167

Bill Lynch's avatar
Bill Lynch committed
168 169 170
                        <span class="jive-error-text">
                        Please enter a valid number.
                        </span>
Matt Tucker's avatar
Matt Tucker committed
171

Bill Lynch's avatar
Bill Lynch committed
172
                    <%  } %>
Matt Tucker's avatar
Matt Tucker committed
173

Bill Lynch's avatar
Bill Lynch committed
174 175 176 177 178 179 180 181 182
                    </td>
                </tr>
                <tr valign="top">
                    <td width="1%" nowrap class="c1">
                        Maximum number of files:
                    </td>
                    <td width="99%">
                        <input type="text" size="15" maxlength="50" name="maxCount"
                         value="<%= ((maxCount != null) ? maxCount : "") %>">
Matt Tucker's avatar
Matt Tucker committed
183

Bill Lynch's avatar
Bill Lynch committed
184
                        <%  if (errors.get("maxCount") != null) { %>
Matt Tucker's avatar
Matt Tucker committed
185

Bill Lynch's avatar
Bill Lynch committed
186 187 188
                            <span class="jive-error-text">
                            Please enter a valid number.
                            </span>
Matt Tucker's avatar
Matt Tucker committed
189

Bill Lynch's avatar
Bill Lynch committed
190
                        <%  } %>
Matt Tucker's avatar
Matt Tucker committed
191

Bill Lynch's avatar
Bill Lynch committed
192 193
                    </td>
                </tr>
194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211
                <tr valign="top">
                    <td width="1%" nowrap class="c1">
                        Flush Interval (seconds):
                    </td>
                    <td width="99%">
                        <input type="text" size="15" maxlength="50" name="logTimeout"
                         value="<%= ((logTimeout != null) ? logTimeout : "") %>">

                    <%  if (errors.get("logTimeout") != null) { %>

                        <span class="jive-error-text">
                        Please enter a valid number.
                        </span>

                    <%  } %>

                    </td>
                </tr>
Bill Lynch's avatar
Bill Lynch committed
212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257
                <tr valign="top">
                    <td width="1%" nowrap class="c1">
                        Packets to audit:
                    </td>
                    <td width="99%">

                        <table cellpadding="4" cellspacing="0" border="0" width="100%">
                        <tr valign="top">
                            <td width="1%" nowrap>
                                <input type="checkbox" name="auditMessages" id="cb01"
                                 onclick="this.form.auditEnabled[1].checked=true;"
                                 <%= (auditMessages ? "checked" : "") %>>
                            </td>
                            <td width="99%">
                                <label for="cb01">
                                <b>Audit Message Packets</b>
                                </label>
                            </td>
                        </tr>
                        <tr valign="top">
                            <td width="1%" nowrap>
                                <input type="checkbox" name="auditPresence" id="cb02"
                                 onclick="this.form.auditEnabled[1].checked=true;"
                                 <%= (auditPresence ? "checked" : "") %>>
                            </td>
                            <td width="99%">
                                <label for="cb02">
                                <b>Audit Presence Packets</b>
                                </label>
                            </td>
                        </tr>
                        <tr valign="top">
                            <td width="1%" nowrap>
                                <input type="checkbox" name="auditIQ" id="cb03"
                                 onclick="this.form.auditEnabled[1].checked=true;"
                                 <%= (auditIQ ? "checked" : "") %>>
                            </td>
                            <td width="99%">
                                <label for="cb03">
                                <b>Audit IQ Packets</b>
                                </label>
                            </td>
                        </tr>
                        </table>
                    </td>
                </tr>
258 259 260 261 262 263 264 265
                <tr valign="top">
                    <td width="1%" nowrap class="c1">
                        Queued packets:
                    </td>
                    <td width="99%">
                         <%= auditManager.getAuditor().getQueuedPacketsNumber() %>
                    </td>
                </tr>
Matt Tucker's avatar
Matt Tucker committed
266 267 268
                </table>
            </td>
        </tr>
Bill Lynch's avatar
Bill Lynch committed
269 270 271 272
    </tbody>
    </table>
    </div>
</fieldset>
Matt Tucker's avatar
Matt Tucker committed
273

Bill Lynch's avatar
Bill Lynch committed
274
<br><br>
Matt Tucker's avatar
Matt Tucker committed
275 276 277 278 279

<input type="submit" name="update" value="Save Settings">

</form>

Bill Lynch's avatar
Bill Lynch committed
280
<jsp:include page="bottom.jsp" flush="true" />