Examples of AuditLogEntry


Examples of co.cask.cdap.common.logging.AuditLogEntry

                     HttpServletResponse response) throws IOException, ServletException {
    logRequest(request, response);
  }

  private void logRequest(HttpServletRequest request, HttpServletResponse response) throws UnknownHostException {
    AuditLogEntry logEntry = new AuditLogEntry();
    logEntry.setUserName(request.getRemoteUser());
    logEntry.setClientIP(InetAddress.getByName(request.getRemoteAddr()));
    logEntry.setRequestLine(request.getMethod(), request.getRequestURI(), request.getProtocol());
    logEntry.setResponseCode(response.getStatus());
    logEntry.setResponseContentLength(((Response) response).getContentCount());
    logger.trace(logEntry.toString());
  }
View Full Code Here

Examples of co.cask.cdap.common.logging.AuditLogEntry

  public void messageReceived(ChannelHandlerContext ctx, final MessageEvent event) throws Exception {
    Object msg = event.getMessage();
    if (!(msg instanceof HttpRequest)) {
      super.messageReceived(ctx, event);
    } else {
      AuditLogEntry logEntry = new AuditLogEntry();
      ctx.setAttachment(logEntry);
      if (validateSecuredInterception(ctx, (HttpRequest) msg, event.getChannel(), logEntry)) {
        Channels.fireMessageReceived(ctx, msg, event.getRemoteAddress());
      } else {
        // we write the response directly for authentication failure, so nothing to do
View Full Code Here

Examples of co.cask.cdap.common.logging.AuditLogEntry

    }
  }

  @Override
  public void writeRequested(ChannelHandlerContext ctx, MessageEvent e) throws Exception {
    AuditLogEntry logEntry = getLogEntry(ctx);
    Object message = e.getMessage();
    if (message instanceof HttpResponse) {
      HttpResponse response = (HttpResponse) message;
      logEntry.setResponseCode(response.getStatus().getCode());
      if (response.containsHeader(HttpHeaders.Names.CONTENT_LENGTH)) {
        String lengthString = response.getHeader(HttpHeaders.Names.CONTENT_LENGTH);
        try {
          logEntry.setResponseContentLength(Long.valueOf(lengthString));
        } catch (NumberFormatException nfe) {
          LOG.warn("Invalid value for content length in HTTP response message: {}", lengthString, nfe);
        }
      }
    } else if (message instanceof ChannelBuffer) {
      // for chunked responses the response code will only be present on the first chunk
      // so we only look for it the first time around
      if (logEntry.getResponseCode() == null) {
        ChannelBuffer channelBuffer = (ChannelBuffer) message;
        logEntry.setResponseCode(findResponseCode(channelBuffer));
        if (logEntry.getResponseCode() != null) {
          // we currently only look for a Content-Length header in the first buffer on an HTTP response
          // this is a limitation of the implementation that simplifies header parsing
          logEntry.setResponseContentLength(findContentLength(channelBuffer));
        }
      }
    } else {
      LOG.debug("Unhandled response message type: {}", message.getClass());
    }
View Full Code Here

Examples of co.cask.cdap.common.logging.AuditLogEntry

    super.writeRequested(ctx, e);
  }

  @Override
  public void writeComplete(ChannelHandlerContext ctx, WriteCompletionEvent e) throws Exception {
    AuditLogEntry logEntry = getLogEntry(ctx);
    if (!logEntry.isLogged()) {
      AUDIT_LOG.trace(logEntry.toString());
      logEntry.setLogged(true);
    }
  }
View Full Code Here

Examples of co.cask.cdap.common.logging.AuditLogEntry

    return contentLength;
  }

  private AuditLogEntry getLogEntry(ChannelHandlerContext ctx) {
    Object entryObject = ctx.getAttachment();
    AuditLogEntry logEntry;
    if (entryObject != null && entryObject instanceof AuditLogEntry) {
      logEntry = (AuditLogEntry) entryObject;
    } else {
      logEntry = new AuditLogEntry();
      ctx.setAttachment(logEntry);
    }
    return logEntry;
  }
View Full Code Here

Examples of com.opengamma.security.auditlog.AuditLogEntry

    ArgumentChecker.notNull(user, "User ID");
    ArgumentChecker.notNull(user, "Originating system name");
    ArgumentChecker.notNull(object, "Object ID");
    ArgumentChecker.notNull(operation, "Operation name");
   
    AuditLogEntry auditLogEntry = new AuditLogEntry(user, originatingSystem, object, operation, description, success, new Date());
    boolean flushCache = false;
    synchronized (this) {
      _auditLogCache.add(auditLogEntry);
      if (_auditLogCache.size() >= _batchSize) {
        flushCache = true;
View Full Code Here

Examples of com.opengamma.security.auditlog.AuditLogEntry

    Session session = getSession();
    Transaction tx = null;
    try {
      tx = session.beginTransaction();
      for (int i = 0; i < auditLogCache.size(); i++) {
        AuditLogEntry auditLogEntry = auditLogCache.get(i);
        session.save(auditLogEntry);
       
        if (i != 0 && i % _batchSize == 0) {
          session.flush();
          session.clear();
View Full Code Here

Examples of org.apache.activemq.broker.util.AuditLogEntry

    public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException {
        if (audit && request instanceof HttpServletRequest) {

            HttpServletRequest http = (HttpServletRequest)request;
            AuditLogEntry entry = new HttpAuditLogEntry();
            if (http.getRemoteUser() != null) {
                entry.setUser(http.getRemoteUser());
            }
            entry.setTimestamp(System.currentTimeMillis());
            entry.setOperation(http.getRequestURI());
            entry.setRemoteAddr(http.getRemoteAddr());
            entry.getParameters().put("params", http.getParameterMap());
            auditLog.log(entry);
        }
        chain.doFilter(request, response);
    }
View Full Code Here

Examples of org.apache.activemq.broker.util.AuditLogEntry

                for (Principal principal : subject.getPrincipals()) {
                    caller += principal.getName() + " ";
                }
            }

            AuditLogEntry entry = new JMXAuditLogEntry();
            entry.setUser(caller);
            entry.setTimestamp(System.currentTimeMillis());
            entry.setOperation(this.getMBeanInfo().getClassName() + "." + s);
            entry.getParameters().put("arguments", objects);

            auditLog.log(entry);
        }
        return super.invoke(s, objects, strings);
    }
View Full Code Here

Examples of org.drools.ide.common.client.modeldriven.auditlog.AuditLogEntry

            return entries;
        }
        final List<AuditLogEntry> filteredEntries = new ArrayList<AuditLogEntry>();
        final Iterator<AuditLogEntry> i = entries.iterator();
        while ( i.hasNext() ) {
            final AuditLogEntry entry = i.next();
            if ( !entry.isDeleted() ) {
                filteredEntries.add( entry );
            }
        }
        return filteredEntries;
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.