Jacson

de.spieleck.app.jacson.filter
Class WebSessionFilter

java.lang.Object
  extended byde.spieleck.app.jacson.PluginBase
      extended byde.spieleck.app.jacson.filter.FilterBase
          extended byde.spieleck.app.jacson.filter.ConstFilter
              extended byde.spieleck.app.jacson.filter.WebSessionFilter
All Implemented Interfaces:
ConfigVerify.Acceptor, FilterNames, JacsonChunkDrain, JacsonFilter, JacsonRegistrable, JacsonReporting, JacsonStately

public class WebSessionFilter
extends ConstFilter

A hack to derive something like a session from a web log file by using the well known ip=user session till timeout logic. This isn't working great, but it is working.
Note: The implementation depends on the fact that timestamps are monotonical increasing in the logfile. If this isn't the case we are in real trouble.
Note: The implementation currently cannot merge sessions between multiple input streams (separated by null chunks)
The plugin understands the following parameters:

Author:
fsn
See Also:
RegExpUtil

Field Summary
static java.lang.String CLIENTREGEXP_NODE
           
protected  java.text.DateFormat dateFormat
          Date parse format
static java.lang.String DATEFORMAT_NODE
           
protected  org.apache.oro.text.regex.Pattern datePattern
          Date regular expression
static java.lang.String DATEREGEXP_NODE
           
static java.lang.String DEFAULT_DATEFORMAT
           
protected  org.apache.oro.text.regex.Pattern idPattern
          ID regular expression
protected  long lastTime
          Object caching for speedup (flyweight pattern)
protected  java.lang.Long lastTimeLong
          Object caching for speedup (flyweight pattern)
protected  RegExpUtil rutil
          Utility for regular expressions
protected  int timeout
          The timeout assumed for a session
static java.lang.String TIMEOUT_NODE
           
static java.lang.String WSF
           
 
Fields inherited from class de.spieleck.app.jacson.filter.ConstFilter
inverse
 
Fields inherited from class de.spieleck.app.jacson.filter.FilterBase
drain
 
Fields inherited from interface de.spieleck.app.jacson.filter.FilterNames
COUNT_NODE, INVERSE_NODE
 
Constructor Summary
WebSessionFilter()
           
 
Method Summary
 boolean accept(ConfigNode node)
           
protected  void flushSessions(long limit)
          Clean up the stored sessions up to a certain point in history.
 void init(ConfigNode node, JacsonRegistry registry)
           
protected  java.lang.String matching(java.lang.String chunk, org.apache.oro.text.regex.Pattern p)
          Convenience method to extract a string from a chunk via a match.
 void putChunk(java.lang.String chunk)
          Feed a single chunk into this filter
 
Methods inherited from class de.spieleck.app.jacson.filter.ConstFilter
summary
 
Methods inherited from class de.spieleck.app.jacson.filter.FilterBase
setDrain
 
Methods inherited from class de.spieleck.app.jacson.PluginBase
getRegReport, getRegState, registerReport, registerState
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface de.spieleck.app.jacson.JacsonStately
registerState
 
Methods inherited from interface de.spieleck.app.jacson.JacsonReporting
registerReport
 

Field Detail

TIMEOUT_NODE

public static final java.lang.String TIMEOUT_NODE
See Also:
Constant Field Values

DATEREGEXP_NODE

public static final java.lang.String DATEREGEXP_NODE
See Also:
Constant Field Values

CLIENTREGEXP_NODE

public static final java.lang.String CLIENTREGEXP_NODE
See Also:
Constant Field Values

DATEFORMAT_NODE

public static final java.lang.String DATEFORMAT_NODE
See Also:
Constant Field Values

DEFAULT_DATEFORMAT

public static final java.lang.String DEFAULT_DATEFORMAT
See Also:
Constant Field Values

WSF

public static final java.lang.String WSF
See Also:
Constant Field Values

rutil

protected RegExpUtil rutil
Utility for regular expressions


timeout

protected int timeout
The timeout assumed for a session


datePattern

protected org.apache.oro.text.regex.Pattern datePattern
Date regular expression


dateFormat

protected java.text.DateFormat dateFormat
Date parse format


idPattern

protected org.apache.oro.text.regex.Pattern idPattern
ID regular expression


lastTime

protected long lastTime
Object caching for speedup (flyweight pattern)


lastTimeLong

protected java.lang.Long lastTimeLong
Object caching for speedup (flyweight pattern)

Constructor Detail

WebSessionFilter

public WebSessionFilter()
Method Detail

init

public void init(ConfigNode node,
                 JacsonRegistry registry)
          throws JacsonConfigException
Specified by:
init in interface JacsonRegistrable
Overrides:
init in class ConstFilter
Throws:
JacsonConfigException

accept

public boolean accept(ConfigNode node)
Specified by:
accept in interface ConfigVerify.Acceptor
Overrides:
accept in class ConstFilter

putChunk

public void putChunk(java.lang.String chunk)
              throws JacsonException
Description copied from interface: JacsonChunkDrain
Feed a single chunk into this filter

Specified by:
putChunk in interface JacsonChunkDrain
Overrides:
putChunk in class ConstFilter
Throws:
JacsonException

flushSessions

protected void flushSessions(long limit)
                      throws JacsonException
Clean up the stored sessions up to a certain point in history.

Throws:
JacsonException

matching

protected java.lang.String matching(java.lang.String chunk,
                                    org.apache.oro.text.regex.Pattern p)
Convenience method to extract a string from a chunk via a match.


Spieleck

Copyleft 2002 spieleck.de.