Package org.jwall.log

Examples of org.jwall.log.LogMessageImpl


   
    Long time = extractTimestamp( line );
   
    // maybe we need to extract the source from the message? e.g. in the remote-syslog setting?
    //
    LogMessageImpl msg = new LogMessageImpl( EventType.GENERIC, time, "", line );
    for( String key : defaultValues.keySet() ){
      if( msg.get( key ) != null )
        msg.set( key, defaultValues.get( key ) );
    }
   
    if( extractor != null ){
        Map<String,String> features = extractor.parse( line );
        for( String key : features.keySet() ){
            msg.set( key, features.get( key ) );
        }
    }
           
    return msg;
  }
View Full Code Here


      time = 0L; //System.currentTimeMillis();
    }

    // maybe we need to extract the source from the message? e.g. in the remote-syslog setting?
    //
    LogMessageImpl msg = new LogMessageImpl( EventType.ERROR, time, "", line );
    log.debug( "Adding defaults {}", defaultValues );
    for( String key : this.defaultValues.keySet() ){
      String val = defaultValues.get( key );
      log.debug( "Adding default value '{}' = '{}'", key, val );
      msg.set( key, val );
    }

    return msg;
  }
View Full Code Here

      time = 0L; //System.currentTimeMillis(); // extractTimestamp( line );
    }
   
    // maybe we need to extract the source from the message? e.g. in the remote-syslog setting?
    //
    LogMessageImpl msg = new LogMessageImpl( EventType.ACCESS, time, "", l );
    for( String key : this.defaultValues.keySet() ){
      String val = defaultValues.get( key );
      log.debug( "Adding default value '{}' = '{}'", key, val );
      msg.set( key, val );
    }

    String request = p.readToken( l );
    String status = p.readToken( l );
    String size = p.readToken( l );
    String referer = p.readToken( l );
    String userAgent = p.readToken( l );
    if( !MParser.isEmpty( userAgent ) )
      msg.set( ModSecurity.REQUEST_HEADERS + ":User-Agent", userAgent );

    if( !MParser.isEmpty( status ) )
      msg.set( ModSecurity.RESPONSE_STATUS, status );
   
    if( !MParser.isEmpty( size ) )
      msg.set( "RESPONSE_SIZE", size );
   
    if( !MParser.isEmpty( referer ) )
      msg.set( ModSecurity.RESPONSE_HEADERS + ":Referer", referer );
   
    if( !MParser.isEmpty( remoteUser ) )
      msg.set( ModSecurity.REMOTE_USER, remoteUser );
   
    msg.set( ModSecurity.REMOTE_ADDR, remoteAddress );
    try {
      if( request.indexOf( " " ) > 0 ){
        String[] tok = request.split( "\\s+" );
        if( tok.length > 1 )
          msg.set( ModSecurity.REQUEST_URI, tok[1] );
      } else
        msg.set( ModSecurity.REQUEST_URI, request );
     
    } catch (Exception e) {
      log.error( "Failed to extract REQUEST_URI from: {}", request );
      e.printStackTrace();
    }
View Full Code Here

TOP

Related Classes of org.jwall.log.LogMessageImpl

Copyright © 2018 www.massapicom. 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.