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();
}