public class RegexHbaseEventSerializer extends Object implements HbaseEventSerializer
HbaseEventSerializer
which parses columns based on a supplied
regular expression and column name list.
Note that if the regular expression does not return the correct number of groups for a particular event, or it does not correctly match an event, the event is silently dropped.
Row keys for each event consist of a timestamp concatenated with an identifier which enforces uniqueness of keys across flume agents.
See static constant variables for configuration options.
Modifier and Type | Field and Description |
---|---|
protected byte[] |
cf |
static String |
CHARSET_CONFIG
What charset to use when serializing into HBase's byte arrays
|
static String |
CHARSET_DEFAULT |
static String |
COL_NAME_CONFIG
Comma separated list of column names to place matching groups in.
|
static String |
COLUMN_NAME_DEFAULT |
static String |
DEPOSIT_HEADERS_CONFIG
Whether to deposit event headers into corresponding column qualifiers
|
static boolean |
DEPOSIT_HEADERS_DEFAULT |
static String |
IGNORE_CASE_CONFIG
Whether to ignore case when performing regex matches.
|
static boolean |
INGORE_CASE_DEFAULT |
protected static AtomicInteger |
nonce |
protected static String |
randomKey |
static String |
REGEX_CONFIG
Regular expression used to parse groups from event data.
|
static String |
REGEX_DEFAULT |
static String |
ROW_KEY_INDEX_CONFIG
Index of the row key in matched regex groups
|
static String |
ROW_KEY_NAME
Placeholder in colNames for row key
|
Constructor and Description |
---|
RegexHbaseEventSerializer() |
Modifier and Type | Method and Description |
---|---|
void |
close() |
void |
configure(ComponentConfiguration conf) |
void |
configure(Context context)
Request the implementing class to (re)configure itself.
|
List<org.apache.hadoop.hbase.client.Row> |
getActions()
Get the actions that should be written out to hbase as a result of this
event.
|
List<org.apache.hadoop.hbase.client.Increment> |
getIncrements() |
protected byte[] |
getRowKey() |
protected byte[] |
getRowKey(Calendar cal)
Returns a row-key with the following format:
[time in millis]-[random key]-[nonce]
|
void |
initialize(Event event,
byte[] columnFamily)
Initialize the event serializer.
|
public static final String REGEX_CONFIG
public static final String REGEX_DEFAULT
public static final String IGNORE_CASE_CONFIG
public static final boolean INGORE_CASE_DEFAULT
public static final String COL_NAME_CONFIG
public static final String COLUMN_NAME_DEFAULT
public static final String ROW_KEY_INDEX_CONFIG
public static final String ROW_KEY_NAME
public static final String DEPOSIT_HEADERS_CONFIG
public static final boolean DEPOSIT_HEADERS_DEFAULT
public static final String CHARSET_CONFIG
public static final String CHARSET_DEFAULT
protected static final AtomicInteger nonce
protected static String randomKey
protected byte[] cf
public void configure(Context context)
Configurable
Request the implementing class to (re)configure itself.
When configuration parameters are changed, they must be reflected by the component asap.
There are no thread safety guarantees on when configure might be called.
configure
in interface Configurable
public void configure(ComponentConfiguration conf)
configure
in interface ConfigurableComponent
public void initialize(Event event, byte[] columnFamily)
HbaseEventSerializer
initialize
in interface HbaseEventSerializer
event
- Event to be written to HBasecolumnFamily
- Column family to write toprotected byte[] getRowKey(Calendar cal)
protected byte[] getRowKey()
public List<org.apache.hadoop.hbase.client.Row> getActions() throws FlumeException
HbaseEventSerializer
getActions
in interface HbaseEventSerializer
Row
which
are written as such to HBase.
0.92 increments do not implement Row, so this is not generic.FlumeException
public List<org.apache.hadoop.hbase.client.Increment> getIncrements()
getIncrements
in interface HbaseEventSerializer
public void close()
close
in interface HbaseEventSerializer
Copyright © 2009-2016 Apache Software Foundation. All Rights Reserved.