-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactoring, added new documentation,...
- Loading branch information
1 parent
dd3e8c5
commit 65cc4c9
Showing
52 changed files
with
2,245 additions
and
263 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
67 changes: 67 additions & 0 deletions
67
stream-log/src/main/java/stream/data/mapper/DNSLookup.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
/** | ||
* | ||
*/ | ||
package stream.data.mapper; | ||
|
||
import java.io.Serializable; | ||
|
||
import org.jwall.web.audit.processor.DNSLookupProcessor; | ||
|
||
import stream.data.Data; | ||
import stream.util.Description; | ||
import stream.util.Parameter; | ||
|
||
/** | ||
* @author chris | ||
* | ||
*/ | ||
@Description( name="DNS Lookup", group="Data Stream.Processing.Annotations" ) | ||
public class DNSLookup | ||
extends DNSLookupProcessor { | ||
|
||
/** | ||
* @see org.jwall.web.audit.processor.DNSLookupProcessor#setKey(java.lang.String) | ||
*/ | ||
@Override | ||
@Parameter( required=true, defaultValue="REMOTE_ADDR" ) | ||
public void setKey(String key) { | ||
super.setKey(key); | ||
} | ||
|
||
|
||
/** | ||
* @see org.jwall.web.audit.processor.DNSLookupProcessor#setTarget(java.lang.String) | ||
*/ | ||
@Override | ||
@Parameter( required=true, defaultValue="REMOTE_HOSTNAME" ) | ||
public void setTarget(String target) { | ||
super.setTarget(target); | ||
} | ||
|
||
|
||
|
||
|
||
/** | ||
* @see org.jwall.web.audit.processor.DNSLookupProcessor#process(stream.data.Data) | ||
*/ | ||
@Override | ||
public Data process(Data data) { | ||
|
||
if( data == null ) | ||
return data; | ||
|
||
Serializable value = data.get( getKey() ); | ||
if( value != null ){ | ||
String hostname = resolve( value.toString() ); | ||
if( hostname != null ) | ||
data.put( getTarget(), hostname + "" ); | ||
} | ||
|
||
return data; | ||
} | ||
|
||
|
||
protected String resolve( String name ){ | ||
return lookup( name ); | ||
} | ||
} |
22 changes: 22 additions & 0 deletions
22
stream-log/src/main/java/stream/data/mapper/DNSReverseLookup.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
/** | ||
* | ||
*/ | ||
package stream.data.mapper; | ||
|
||
import stream.util.Description; | ||
|
||
/** | ||
* @author chris | ||
* | ||
*/ | ||
@Description( name = "DNS Reverse lookup", group="Data Stream.Processing.Annotations" ) | ||
public class DNSReverseLookup extends DNSLookup { | ||
|
||
/** | ||
* @see stream.data.mapper.DNSLookup#resolve(java.lang.String) | ||
*/ | ||
@Override | ||
protected String resolve(String name) { | ||
return this.reverseLookup( name ); | ||
} | ||
} |
17 changes: 17 additions & 0 deletions
17
stream-log/src/main/resources/stream/data/mapper/DNSLookup.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
DNS Lookup | ||
========== | ||
|
||
This processor simply checks for the hostname of a given | ||
IP address. The IP address can either be IPv4 or IPv6. | ||
Lookup is carried out using the local naming services. The | ||
processor integrates a simple, limited cache to speed up | ||
lookups. | ||
|
||
The following example will lookup the IP address of the | ||
hostname found in attribute `REMOTE_HOST` and store the | ||
resolved address in attribute `REMOTE_ADDR`: | ||
|
||
<DNSLookup key="REMOTE_HOST" target="REMOTE_ADDR" /> | ||
|
||
The cache size is set with the `cacheSize` parameter. By | ||
default the size of the cache is 10000 entries. |
21 changes: 21 additions & 0 deletions
21
stream-log/src/main/resources/stream/data/mapper/DNSReverseLookup.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
DNS Reverse Lookup | ||
================== | ||
|
||
This processor translates IP addresses back to their host | ||
names. The lookup is performed using the local naming service. | ||
|
||
Two keys need to be specified: the `key` parameter specifies | ||
the attribute that is used as address (IPv4 or IPv6) to be | ||
mapped to a hostname. The `target` parameter specifies the | ||
name of the attribute into which the hostname should be stored. | ||
|
||
The following example will lookup the attribute value for | ||
`REMOTE_ADDR` and will write the result into the attribute | ||
`HOSTNAME`: | ||
|
||
<DNSReverseLookup key="REMOTE_ADDR" target="HOSTNAME" /> | ||
|
||
The processor integrates a simple, limited cache to speed up | ||
lookups. | ||
The cache size is set with the `cacheSize` parameter. By | ||
default the size of the cache is 10000 entries. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.