various fixes

This commit is contained in:
Marian Novotny
2022-11-17 15:15:39 +00:00
parent 72c6b449b5
commit 746472df88
41 changed files with 97 additions and 98 deletions

View File

@@ -5,8 +5,7 @@ import org.slf4j.LoggerFactory;
import uk.co.gresearch.siembol.parsers.common.ParserResult; import uk.co.gresearch.siembol.parsers.common.ParserResult;
import uk.co.gresearch.siembol.parsers.common.SerializableSiembolParser; import uk.co.gresearch.siembol.parsers.common.SerializableSiembolParser;
import java.lang.invoke.MethodHandles; import java.lang.invoke.MethodHandles;
import java.util.ArrayList;
import java.util.List;
/** /**
* An object for parsing application that integrates a single parser * An object for parsing application that integrates a single parser
* *

View File

@@ -6,7 +6,7 @@ import java.util.Map;
* An object for representing a parser result * An object for representing a parser result
* *
* <p>This class contains a list of parsed messages and * <p>This class contains a list of parsed messages and
* exception in case a parser throws an error. * exception if a parser throws an error.
* It provides metadata about the parsed messages such as the source type. * It provides metadata about the parsed messages such as the source type.
* *
* @author Marian Novotny * @author Marian Novotny

View File

@@ -18,7 +18,7 @@ public interface SiembolParser {
* Parses the message along with metadata * Parses the message along with metadata
* *
* @param metadata Metadata about the message as a json string * @param metadata Metadata about the message as a json string
* @param message Message as a byte array. Both binary and text logs are possible to parse. * @param message Message as a byte array. Both binary and text logs are supported.
* @return list of parsed messages - maps of Strings to Objects * @return list of parsed messages - maps of Strings to Objects
*/ */
default List<Map<String, Object>> parse(String metadata, byte[] message) { default List<Map<String, Object>> parse(String metadata, byte[] message) {
@@ -28,7 +28,7 @@ public interface SiembolParser {
/** /**
* Parses the message along with metadata * Parses the message along with metadata
* *
* @param message Message as a byte array. Both binary and text logs are possible to parse. * @param message Message as a byte array. Both binary and text logs are supported.
* @return list of parsed messages - maps of Strings to Objects * @return list of parsed messages - maps of Strings to Objects
*/ */
List<Map<String, Object>> parse(byte[] message); List<Map<String, Object>> parse(byte[] message);
@@ -37,7 +37,7 @@ public interface SiembolParser {
* Parses the message along with metadata into a ParserResult structure * Parses the message along with metadata into a ParserResult structure
* *
* @param metadata Metadata about the message as a json string * @param metadata Metadata about the message as a json string
* @param message Message as a byte array. Both binary and text logs are possible to parse. * @param message Message as a byte array. Both binary and text logs are supported.
* @return parser result with list of parsed messages and metadata about the parsing result * @return parser result with list of parsed messages and metadata about the parsing result
* @see ParserResult * @see ParserResult
*/ */

View File

@@ -8,7 +8,7 @@ import java.util.stream.Collectors;
* An object for extracting fields using CSV extracting * An object for extracting fields using CSV extracting
* *
* <p>This derived class of ParserExtractor provides functionality for CSV (Comma Separated Values) extracting. * <p>This derived class of ParserExtractor provides functionality for CSV (Comma Separated Values) extracting.
* It uses column names list for adding field names with possibility to skip some columns. * It uses column names list for adding field names supporting to skip some columns.
* It supports handling quotas. * It supports handling quotas.
* *
* @author Marian Novotny * @author Marian Novotny
@@ -129,7 +129,7 @@ public class CSVExtractor extends ParserExtractor {
*/ */
public static Builder<CSVExtractor> builder() { public static Builder<CSVExtractor> builder() {
return new Builder<CSVExtractor>() { return new Builder<>() {
@Override @Override
public CSVExtractor build() { public CSVExtractor build() {
if (this.columnNamesList == null || if (this.columnNamesList == null ||
@@ -161,7 +161,7 @@ public class CSVExtractor extends ParserExtractor {
protected List<ColumnNames> columnNamesList = new ArrayList<>(); protected List<ColumnNames> columnNamesList = new ArrayList<>();
/** /**
* Sets word delimiter for delimiting a row value - ',' by default * Sets word delimiter for delimiting a row value (',' by default)
* *
* @param wordDelimiter word delimiter for delimiting a row value * @param wordDelimiter word delimiter for delimiting a row value
* @return this builder * @return this builder

View File

@@ -6,7 +6,7 @@ import java.util.List;
/** /**
* An object that represents structure for column names * An object that represents structure for column names
* *
* <p>This object represents helper structure for column names used in CSV parser extractor * <p>This object represents helper structure for representing column names used in CSV parser extractor.
* *
* @author Marian Novotny * @author Marian Novotny
*/ */

View File

@@ -12,10 +12,10 @@ import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
/** /**
* An object for extracting fields from the message using json parser * An object for extracting fields from the message using json parsing
* *
* <p>This derived class of ParserExtractor class is using json parsing to extract fields from the massage. * <p>This derived class of ParserExtractor class is using json parsing to extract fields from the massage.
* The extractor is parsing json string recursively in order to create a flat map of extracting fields. * The extractor is parsing a json string recursively in order to create a flat map of extracting fields.
* *
* @author Marian Novotny * @author Marian Novotny
* @see ParserExtractor * @see ParserExtractor
@@ -74,7 +74,7 @@ public class JsonExtractor extends ParserExtractor {
} }
/** /**
* Extracts a message string using json parser * Extracts a message string using a json parser
* *
* @param message input message to be extracted * @param message input message to be extracted
* @return map of string to object with extracted fields * @return map of string to object with extracted fields
@@ -107,7 +107,7 @@ public class JsonExtractor extends ParserExtractor {
*/ */
public static Builder<JsonExtractor> builder() { public static Builder<JsonExtractor> builder() {
return new Builder<JsonExtractor>() { return new Builder<>() {
@Override @Override
public JsonExtractor build() { public JsonExtractor build() {
return new JsonExtractor(this); return new JsonExtractor(this);

View File

@@ -16,7 +16,7 @@ import java.lang.invoke.MethodHandles;
import java.util.*; import java.util.*;
/** /**
* An object for extracting fields from the message using json path queries * An object for extracting fields from the message by evaluating json path queries
* *
* <p>This derived class of ParserExtractor class is using json path query to extract fields from the massage. * <p>This derived class of ParserExtractor class is using json path query to extract fields from the massage.
* The extractor is evaluating json path queries in order to create a map of extracting fields. * The extractor is evaluating json path queries in order to create a map of extracting fields.
@@ -116,7 +116,7 @@ public class JsonPathExtractor extends ParserExtractor {
} }
/** /**
* Extracts a message string using json path queries * Extracts fields from a message string using json path queries
* *
* @param message input message to be extracted * @param message input message to be extracted
* @return map of string to object with extracted fields * @return map of string to object with extracted fields
@@ -179,8 +179,9 @@ public class JsonPathExtractor extends ParserExtractor {
protected EnumSet<JsonPathExtractorFlags> jsonPathExtractorFlags = EnumSet.noneOf(JsonPathExtractorFlags.class); protected EnumSet<JsonPathExtractorFlags> jsonPathExtractorFlags = EnumSet.noneOf(JsonPathExtractorFlags.class);
/** /**
* Adds a json path query string * Adds a json path query string.
* It supports a dot and a bracket notation using syntax from https://github.com/json-path/JsonPath#readme * It supports a dot and a bracket notation using syntax from
* <a href="https://github.com/json-path/JsonPath#readme">https://github.com/json-path/JsonPath#readme</a> .
* *
* @param field A field name for storing query result * @param field A field name for storing query result
* @param query A json path query * @param query A json path query

View File

@@ -40,7 +40,7 @@ public class KeyValueExtractor extends ParserExtractor {
} }
/** /**
* Extracts a message string using key value extracting * Extracts fields from a message string using key value extracting
* *
* @param message input message to be extracted * @param message input message to be extracted
* @return map of string to object with extracted fields * @return map of string to object with extracted fields
@@ -184,9 +184,9 @@ public class KeyValueExtractor extends ParserExtractor {
} }
/** /**
* Sets the function for returning an end index of key-value pair * Sets the function for returning the ending index of key-value pair
* *
* @param indexOf the function for returning end index of the key-value pair * @param indexOf the function for returning the ending index of the key-value pair
* @return this builder * @return this builder
*/ */
public Builder<T> indexOfEnd(KeyValueIndices.IndexOf indexOf) { public Builder<T> indexOfEnd(KeyValueIndices.IndexOf indexOf) {

View File

@@ -3,7 +3,7 @@ package uk.co.gresearch.siembol.parsers.extractors;
/** /**
* An object that represents structure for handling key value indices * An object that represents structure for handling key value indices
* *
* <p>This object represents helper structure for handling key value indices used in KeyValueExctractor * <p>This object represents helper structure for handling key value indices used in KeyValueExtractor
* *
* @author Marian Novotny * @author Marian Novotny
* @see KeyValueExtractor.Builder * @see KeyValueExtractor.Builder

View File

@@ -10,10 +10,10 @@ import java.util.List;
import java.util.Optional; import java.util.Optional;
import java.util.regex.Pattern; import java.util.regex.Pattern;
/** /**
* An object that formats a string timestamps into millisecond epoch time * An object that formats a string timestamps into a millisecond epoch time
* *
* <p>This object validates, parses and formats a string timestamps into millisecond epoch time. * <p>This object validates, parses and formats a string timestamps into a millisecond epoch time.
* It supports list of formatters that are executed in a chain until the first formatter will be successful. * It supports list of formatters that are executed in a chain until the first formatter is successful.
* *
* @author Marian Novotny * @author Marian Novotny
*/ */

View File

@@ -8,7 +8,7 @@ import static uk.co.gresearch.siembol.parsers.extractors.ParserExtractor.ParserE
* An object for extracting fields from the message * An object for extracting fields from the message
* *
* <p>This abstract class is using template pattern for handling common functionality of all extractors. * <p>This abstract class is using template pattern for handling common functionality of all extractors.
* The extractor is registered on a field and extracting the key value pairs after processing the field value. * The extractor is registered on a field and extracting the key value pairs during processing the field value.
* *
* @author Marian Novotny * @author Marian Novotny
* @see JsonExtractor * @see JsonExtractor
@@ -108,11 +108,11 @@ public abstract class ParserExtractor {
} }
/** /**
* Applies a pre-processing function. * Applies a pre-processing function on an input string.
* Extracts key value pairs from an input string. * Extracts key value pairs from the input string.
* Applies the post-processing functions. * Applies the post-processing functions on extracted pairs.
* *
* @param str Input string * @param str an input string
* @return extracted key value pairs as a map of String to Object * @return extracted key value pairs as a map of String to Object
*/ */
public Map<String, Object> extract(String str) { public Map<String, Object> extract(String str) {
@@ -155,7 +155,7 @@ public abstract class ParserExtractor {
} }
/** /**
* An abstract builder for parser extractor * An abstract builder for a parser extractor
* *
* <p>This abstract class is using Builder pattern. * <p>This abstract class is using Builder pattern.
* *
@@ -172,9 +172,9 @@ public abstract class ParserExtractor {
new ArrayList<>(); new ArrayList<>();
/** /**
* Sets name of the extractor * Sets the name of the extractor
* *
* @param name name of the extractor * @param name the name of the extractor
* @return this builder * @return this builder
*/ */
public Builder<T> name(String name) { public Builder<T> name(String name) {
@@ -183,9 +183,9 @@ public abstract class ParserExtractor {
} }
/** /**
* Sets field name of the extractor * Sets a field name of the extractor
* *
* @param field field name of the extractor * @param field a field name of the extractor
* @return this builder * @return this builder
*/ */
public Builder<T> field(String field) { public Builder<T> field(String field) {
@@ -208,7 +208,7 @@ public abstract class ParserExtractor {
/** /**
* Sets a pre-processing function of the extractor * Sets a pre-processing function of the extractor
* *
* @param preProcessing Pre-processing function of the extractor * @param preProcessing A pre-processing function of the extractor
* @return this builder * @return this builder
*/ */
public Builder<T> preProcessing(Function<String, String> preProcessing) { public Builder<T> preProcessing(Function<String, String> preProcessing) {
@@ -219,7 +219,7 @@ public abstract class ParserExtractor {
/** /**
* Sets a list of post-processing functions of the extractor * Sets a list of post-processing functions of the extractor
* *
* @param postProcessing List of post-processing functions of the extractor * @param postProcessing A list of post-processing functions of the extractor
* @return this builder * @return this builder
*/ */
public Builder<T> postProcessing(List<Function<Map<String, Object>, public Builder<T> postProcessing(List<Function<Map<String, Object>,
@@ -232,11 +232,11 @@ public abstract class ParserExtractor {
} }
/** /**
* Extracts a message by executing a list of extractors * Extracts pairs from a message object by executing a list of extractors
* *
* @param extractors List fo extractors to be executed in a chain * @param extractors List of extractors to be executed in a chain
* @param messageObject initial message that will be extended by calling a chain of extractors * @param messageObject an initial message object that will be extended by calling a chain of extractors
* @return message after executing all extractors * @return the message object after executing all extractors
*/ */
public static Map<String, Object> extract( public static Map<String, Object> extract(
List<ParserExtractor> extractors, List<ParserExtractor> extractors,

View File

@@ -9,7 +9,7 @@ import static uk.co.gresearch.siembol.common.constants.SiembolMessageFields.TIME
/** /**
* A library of helper static functions used in parsing extractors * A library of helper static functions used in parsing extractors
* *
* <p>This class provides placeholder of helper static functions used in parsing extractors * <p>This class provides placeholder for helper static functions used in parsing extractors
* *
* @author Marian Novotny * @author Marian Novotny
*/ */

View File

@@ -42,9 +42,9 @@ public class PatternExtractor extends ParserExtractor {
/** /**
* Implementation of template method for extracting key value pairs from an input string. * Implementation of template method for extracting key value pairs from an input string.
* The list of regular expression named groups are executed in a chain. * The list of regular expression named groups are executed in a chain.
* The pattern needs to match in order to be extracted and included in the result. * The fields are extracted and included in the result only if the pattern matches the input string.
* *
* @param str Input string * @param str An input string
* @return extracted key value pairs as a map of String to Object * @return extracted key value pairs as a map of String to Object
*/ */
@Override @Override
@@ -107,7 +107,7 @@ public class PatternExtractor extends ParserExtractor {
} }
/** /**
* Creates pattern extractor builder instance * Creates a pattern extractor builder instance
* *
* @return pattern extractor builder * @return pattern extractor builder
*/ */

View File

@@ -42,11 +42,11 @@ public class RegexSelectExtractor extends ParserExtractor {
} }
public static Builder<RegexSelectExtractor> builder() { public static Builder<RegexSelectExtractor> builder() {
return new Builder<RegexSelectExtractor>() { return new Builder<>() {
@Override @Override
public RegexSelectExtractor build() { public RegexSelectExtractor build() {
if (this.outputField == null if (this.outputField == null
|| patterns == null){ || patterns == null) {
throw new IllegalArgumentException(MISSING_ARGUMENTS); throw new IllegalArgumentException(MISSING_ARGUMENTS);
} }
return new RegexSelectExtractor(this); return new RegexSelectExtractor(this);

View File

@@ -2,8 +2,8 @@ package uk.co.gresearch.siembol.parsers.factory;
/** /**
* An object for compiling parsers * An object for compiling parsers
* *
* <p>This interface is for creating a parser, testing a parser on input, validating parser configuration and * <p>This interface is for creating a parser, testing a parser on an input, validating a parser configuration and
* providing json schema for parser configurations. * providing a json schema for parser configurations.
* *
* @author Marian Novotny * @author Marian Novotny
* @see ParserFactoryResult * @see ParserFactoryResult
@@ -12,9 +12,9 @@ package uk.co.gresearch.siembol.parsers.factory;
public interface ParserFactory { public interface ParserFactory {
/** /**
* Gets json schema of parser configurations * Gets the json schema of parser configurations
* *
* @return parser factory result with json schema of parser configurations * @return parser factory result with the json schema of parser configurations
* @see ParserFactoryResult * @see ParserFactoryResult
*/ */
ParserFactoryResult getSchema(); ParserFactoryResult getSchema();

View File

@@ -31,8 +31,8 @@ import static uk.co.gresearch.siembol.parsers.model.PreProcessingFunctionDto.STR
* An object for compiling parsers * An object for compiling parsers
* *
* <p>This class is an implementation of ParserFactory interface. * <p>This class is an implementation of ParserFactory interface.
* It is used for creating a parser, testing a parser on input, validating parser configuration and * It is used for creating a parser, testing a parser on input, validating a parser configuration and
* providing json schema for parser configurations. * providing the json schema for parser configurations.
* *
* @author Marian Novotny * @author Marian Novotny
* @see ParserFactory * @see ParserFactory

View File

@@ -14,7 +14,7 @@ public class ParserFactoryResult {
public enum StatusCode { public enum StatusCode {
OK, OK,
ERROR ERROR
}; }
private final StatusCode statusCode; private final StatusCode statusCode;
private final ParserFactoryAttributes attributes; private final ParserFactoryAttributes attributes;

View File

@@ -17,9 +17,9 @@ import static java.nio.charset.StandardCharsets.UTF_8;
* *
* <p>This class is an implementation of SiembolParser interface. * <p>This class is an implementation of SiembolParser interface.
* It is used for parsing a log by creating two fields: * It is used for parsing a log by creating two fields:
* - 'original_string; with the message, * - 'original_string' field with the input message,
* - 'timestamp' with the current time in milliseconds. * - 'timestamp' field with the current time in milliseconds.
* It evaluates chain of extractors and transformations if registered. * It evaluates the chain of extractors and transformations if registered.
* @author Marian Novotny * @author Marian Novotny
* @see SiembolParser * @see SiembolParser
* *

View File

@@ -3,7 +3,7 @@ package uk.co.gresearch.siembol.parsers.model;
import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonProperty;
import com.github.reinert.jjschema.Attributes; import com.github.reinert.jjschema.Attributes;
/** /**
* A data transfer object for representing column filter in csv extractor * A data transfer object for representing column filter in a csv extractor
* *
* <p>This class is used for json (de)serialisation of a column filter and * <p>This class is used for json (de)serialisation of a column filter and
* for generating json schema from this class using annotations. * for generating json schema from this class using annotations.

View File

@@ -4,7 +4,7 @@ import com.github.reinert.jjschema.Attributes;
import java.util.List; import java.util.List;
/** /**
* A data transfer object for representing column names in csv extractor * A data transfer object for representing column names in a csv extractor
* *
* <p>This class is used for json (de)serialisation of a column names and * <p>This class is used for json (de)serialisation of a column names and
* for generating json schema from this class using annotations. * for generating json schema from this class using annotations.

View File

@@ -3,7 +3,6 @@ package uk.co.gresearch.siembol.parsers.model;
import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonProperty;
import com.github.reinert.jjschema.Attributes; import com.github.reinert.jjschema.Attributes;
import java.util.List;
/** /**
* A data transfer object for representing attributes for json path query * A data transfer object for representing attributes for json path query
* *

View File

@@ -4,7 +4,7 @@ import com.github.reinert.jjschema.Attributes;
import java.util.List; import java.util.List;
/** /**
* A data transfer object for representing attributes for message filter transformation * A data transfer object for representing attributes for a message filter transformation
* *
* <p>This class is used for json (de)serialisation of a message filter transformation and * <p>This class is used for json (de)serialisation of a message filter transformation and
* for generating json schema from this class using annotations. * for generating json schema from this class using annotations.

View File

@@ -3,9 +3,9 @@ import com.fasterxml.jackson.annotation.JsonProperty;
import com.github.reinert.jjschema.Attributes; import com.github.reinert.jjschema.Attributes;
import java.util.List; import java.util.List;
/** /**
* A data transfer object for representing attributes for a parser config * A data transfer object for representing attributes for a parser configuration
* *
* <p>This class is used for json (de)serialisation of a parser config and * <p>This class is used for json (de)serialisation of a parser configuration and
* for generating json schema from this class using annotations. * for generating json schema from this class using annotations.
* *
* @author Marian Novotny * @author Marian Novotny

View File

@@ -5,7 +5,7 @@ import com.github.reinert.jjschema.Attributes;
import java.util.List; import java.util.List;
/** /**
* A data transfer object for representing attributes of a regex select * A data transfer object for representing attributes of a regex select extractor
* *
* <p>This class is used for json (de)serialisation of a regex select used in a regex select extractor and * <p>This class is used for json (de)serialisation of a regex select used in a regex select extractor and
* for generating json schema from this class using annotations. * for generating json schema from this class using annotations.

View File

@@ -3,7 +3,7 @@ package uk.co.gresearch.siembol.parsers.model;
import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonProperty;
import com.github.reinert.jjschema.Attributes; import com.github.reinert.jjschema.Attributes;
/** /**
* An enum for representing a syslog verson * An enum for representing a syslog version
* *
* <p>This enum is used for json (de)serialisation of case type. * <p>This enum is used for json (de)serialisation of case type.
* *

View File

@@ -5,7 +5,7 @@ import com.github.reinert.jjschema.Attributes;
import java.util.List; import java.util.List;
/** /**
* A data transfer object for representing a transformation function attribute * A data transfer object for representing a transformation attributes
* *
* <p>This class is used for json (de)serialisation of attributes of a transformation and * <p>This class is used for json (de)serialisation of attributes of a transformation and
* for generating json schema from this class using annotations. * for generating json schema from this class using annotations.

View File

@@ -5,7 +5,7 @@ import com.github.reinert.jjschema.Attributes;
/** /**
* An enum for representing a transformation type * An enum for representing a transformation type
* *
* <p>This enum is used for json (de)serialisation of transformation type. * <p>This enum is used for json (de)serialisation of a transformation type.
* *
* @author Marian Novotny * @author Marian Novotny
* @see com.fasterxml.jackson.annotation.JsonProperty * @see com.fasterxml.jackson.annotation.JsonProperty

View File

@@ -2,7 +2,7 @@ package uk.co.gresearch.siembol.parsers.netflow;
/** /**
* An interface for reading from a binary buffer * An interface for reading from a binary buffer
* *
* <p>This functional interface is used for reading form binary buffer. * <p>This functional interface is used for reading form a binary buffer.
* *
* @author Marian Novotny * @author Marian Novotny
* *
@@ -10,4 +10,4 @@ package uk.co.gresearch.siembol.parsers.netflow;
@FunctionalInterface @FunctionalInterface
public interface NetflowBufferReader { public interface NetflowBufferReader {
Object read(BinaryBuffer buffer, int fieldLength); Object read(BinaryBuffer buffer, int fieldLength);
}; }

View File

@@ -13,7 +13,7 @@ import static java.nio.charset.StandardCharsets.UTF_8;
* An enum of netflow v9 data types * An enum of netflow v9 data types
* *
* <p>This enum represent a netflow v9 data types. * <p>This enum represent a netflow v9 data types.
* It provides a function for parsing a binary buffer. * A data type includes a function for reading a binary buffer.
* *
* @author Marian Novotny * @author Marian Novotny
* @see NetflowBufferReader * @see NetflowBufferReader
@@ -99,8 +99,8 @@ public enum NetflowDataType implements NetflowBufferReader {
try { try {
return Inet4Address.getByAddress(dst).getHostAddress(); return Inet4Address.getByAddress(dst).getHostAddress();
} catch (Exception e) { } catch (Exception e) {
LOG.error(String.format("Invalid Ipv4 address: %s"), LOG.error(String.format("Invalid Ipv4 address: %s",
new String(dst, UTF_8)); new String(dst, UTF_8)));
return UNKNOWN_IPV4; return UNKNOWN_IPV4;
} }
} }
@@ -115,8 +115,8 @@ public enum NetflowDataType implements NetflowBufferReader {
try { try {
return Inet6Address.getByAddress(dst).getHostAddress(); return Inet6Address.getByAddress(dst).getHostAddress();
} catch (Exception e) { } catch (Exception e) {
LOG.error(String.format("Invalid Ipv6 address: %s"), LOG.error(String.format("Invalid Ipv6 address: %s",
new String(dst, UTF_8)); new String(dst, UTF_8)));
return UNKNOWN_IPV6; return UNKNOWN_IPV6;
} }
} }

View File

@@ -35,7 +35,7 @@ public class NetflowField {
try { try {
return dataType.read(buffer, length); return dataType.read(buffer, length);
} catch (Exception e) { } catch (Exception e) {
LOG.error(String.format("Exception during parsing field %s type: %d, len: %d, exception: %s, buffer: %s", LOG.error(String.format("Exception during parsing field %s type: %s, len: %d, exception: %s, buffer: %s",
ExceptionUtils.getStackTrace(e), ExceptionUtils.getStackTrace(e),
getName(), getName(),
type, type,

View File

@@ -7,8 +7,8 @@ import static uk.co.gresearch.siembol.parsers.netflow.NetflowDataType.*;
/** /**
* An enum of netflow v9 field types * An enum of netflow v9 field types
* *
* <p>This enum represent a netflow v9 field types. * <p>This enum represents a netflow v9 field types.
* It provides a name, type code and data type for parsing a field. * It provides a name, a type code and a data type used for parsing a field.
* *
* @author Marian Novotny * @author Marian Novotny
* @see NetflowBufferReader * @see NetflowBufferReader

View File

@@ -2,7 +2,7 @@ package uk.co.gresearch.siembol.parsers.netflow;
/** /**
* An object for representing a netflow header * An object for representing a netflow header
* *
* <p>This class represents netflow header used by a netflow parser. * <p>This class represents a netflow header used by a netflow parser.
* *
* @author Marian Novotny * @author Marian Novotny
* *

View File

@@ -1,9 +1,9 @@
package uk.co.gresearch.siembol.parsers.netflow; package uk.co.gresearch.siembol.parsers.netflow;
/** /**
* An object for providing netflow transport message * An object for providing a netflow transport message
* *
* <p>This class is implementing NetflowTransportMessage interface. * <p>This class is implementing NetflowTransportMessage interface.
* It uses string identification of device such as its IP address that is unique per device. * It uses a string identification of a device such as its IP address that must be unique per a device.
* *
* @author Marian Novotny * @author Marian Novotny
* @see NetflowTransportMessage * @see NetflowTransportMessage

View File

@@ -8,11 +8,13 @@ import java.util.*;
/** /**
* An object for parsing a netflow v9 message * An object for parsing a netflow v9 message
* *
* <p>This class implements a fault-tolerant netflow v 9 parser. * <p>This class implements a fault-tolerant netflow v9 parser.
* Netflow v9 is parsing data using netflow templates messages that are identified by a device and template id. * Parsing of fields in Netflow v9 protocol is based on the netflow template messages that
* Network devices are using template id field as a counter rather than a unique id on the network and * are identified by a device and template id.
* collisions of template id between devices is common on a network with multiple collectors. * Network devices are using template id field as a counter rather than as a unique id on the network and
* This way we are using NetflowTransportProvider interface to provide global id of the template. * collisions of template id values on a network with multiple collectors are common.
* This way we are using NetflowTransportProvider interface to provide global id of the template in order
* to avoid collisions.
* *
* @author Marian Novotny * @author Marian Novotny
* @see NetflowParsingResult * @see NetflowParsingResult

View File

@@ -6,7 +6,7 @@ import java.util.List;
/** /**
* An object for representing a netflow parsing result * An object for representing a netflow parsing result
* *
* <p>This class represents netflow parsing result used by a netflow parser. * <p>This class represents a netflow parsing result used by a netflow parser.
* It includes a status code of the result along with a netflow parsed message. * It includes a status code of the result along with a netflow parsed message.
* *
* @author Marian Novotny * @author Marian Novotny

View File

@@ -2,7 +2,7 @@ package uk.co.gresearch.siembol.parsers.netflow;
/** /**
* An interface for representing a netflow message used by NetflowTransportProvider * An interface for representing a netflow message used by NetflowTransportProvider
* *
* <p>This interface is used for representing netflow transport message * <p>This interface is used for representing a netflow transport message
* *
* @author Marian Novotny * @author Marian Novotny
* *
@@ -13,7 +13,7 @@ public interface NetflowTransportMessage<T> {
* Gets a unique global ID that identifies the template in the global template store * Gets a unique global ID that identifies the template in the global template store
* @param header a netflow header * @param header a netflow header
* @param templateId id of the template * @param templateId id of the template
* @return Object of the type T that will be used as a key in a templates store * @return an object of the type T that will be used as a key in a templates store
*/ */
public T getGlobalTemplateId(NetflowHeader header, int templateId); public T getGlobalTemplateId(NetflowHeader header, int templateId);
@@ -28,14 +28,14 @@ public interface NetflowTransportMessage<T> {
/** /**
* Gets a global identifier of the device which sent the netflow message * Gets a global identifier of the device which sent the netflow message
* *
* @return returns String that identifies the device on the network that produces the netflow packet * @return a string that identifies the device on the network that produces the netflow packet
*/ */
public String getGlobalSource(); public String getGlobalSource();
/** /**
* Gets the original string used in parsed message. * Gets the original string used in parsed message.
* *
* @return returns String that should be used for original string. * @return a string that should be used in 'original_string' field
*/ */
public String getOriginalString(); public String getOriginalString();
} }

View File

@@ -9,9 +9,9 @@ import java.util.*;
* An object for providing netflow templates * An object for providing netflow templates
* *
* <p>This class is implementing NetflowTransportProvider interface. * <p>This class is implementing NetflowTransportProvider interface.
* It uses in memory map for storing and obtaining templates. * It uses an in-memory map for storing and obtaining templates.
* It uses NetflowMessageWithSource implementation. * It uses NetflowMessageWithSource implementation.
* This map is not synchronised since it is not shared between threads in Storm integration. * This map is not synchronised since it is not shared between threads in the storm integration.
* *
* @author Marian Novotny * @author Marian Novotny
* @see NetflowTransportProvider * @see NetflowTransportProvider

View File

@@ -6,7 +6,6 @@ import org.joda.time.format.DateTimeFormat;
import org.joda.time.format.DateTimeFormatter; import org.joda.time.format.DateTimeFormatter;
import org.joda.time.format.DateTimeFormatterBuilder; import org.joda.time.format.DateTimeFormatterBuilder;
import org.joda.time.format.DateTimeParser; import org.joda.time.format.DateTimeParser;
import uk.co.gresearch.siembol.parsers.common.SiembolParser;
import java.time.ZonedDateTime; import java.time.ZonedDateTime;
import java.time.format.DateTimeParseException; import java.time.format.DateTimeParseException;

View File

@@ -6,9 +6,9 @@ import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Optional; import java.util.Optional;
/** /**
* An object for representing a syslog message after syslog parsing * An object for representing a syslog message used in syslog parsing
* *
* <p>This class represents a syslog message after parsing by an internal syslog parser. * <p>This class represents a syslog message in the internal syslog parser.
* *
* @author Marian Novotny * @author Marian Novotny
* @see SyslogParser * @see SyslogParser

View File

@@ -5,9 +5,9 @@ import java.util.function.Function;
/** /**
* An object for transformation * An object for transformation
* *
* <p>This functional interface for parsing transformations. * <p>This functional interface is used for representing parsing transformations.
* It is a functional interface that extends Function interface for * It is a functional interface that extends Function interface for
* a function with a map of String to Object argument that returns a map of String to Object. * a function of a map of String to Object argument that returns a map of String to Object.
* *
* @author Marian Novotny * @author Marian Novotny
* *

View File

@@ -4,7 +4,6 @@ import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.tuple.Pair; import org.apache.commons.lang3.tuple.Pair;
import uk.co.gresearch.siembol.common.utils.FieldFilter; import uk.co.gresearch.siembol.common.utils.FieldFilter;
import uk.co.gresearch.siembol.common.utils.PatternFilter; import uk.co.gresearch.siembol.common.utils.PatternFilter;
import uk.co.gresearch.siembol.parsers.syslog.SyslogParser;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;