public class SplunkQueryBuilder extends Object
Modifier and Type | Field and Description |
---|---|
static String |
EQUAL_OPERATOR |
static String |
GREATER_THAN |
static String |
GREATER_THAN_EQ |
static String |
LESS_THAN |
static String |
LESS_THAN_EQ |
static String |
NOT_EQUAL_OPERATOR |
Constructor and Description |
---|
SplunkQueryBuilder(String index) |
Modifier and Type | Method and Description |
---|---|
boolean |
addField(String field)
Adds a field name to a Splunk query.
|
void |
addFilter(String left,
String right,
String operator)
Adds a filter to the Splunk query.
|
void |
addFilters(Map<String,ExprNode.ColRelOpConstNode> filters)
Processes the filters for a Splunk query
|
void |
addLimit(int limit)
Adds a row limit to the query.
|
void |
addNotNullFilter(String fieldName)
Adds an isnotnull() filter to the Splunk query
|
void |
addNullFilter(String fieldName)
Adds an isnull() filter to the Splunk query
|
void |
addSourceType(String sourceType)
Adds a sourcetype to the Splunk query.
|
String |
build() |
static boolean |
isNumeric(String str)
Returns true if the given string is numeric, false if not
|
String |
quoteString(String word)
Adds quotes around text for use in SPL queries.
|
public static final String EQUAL_OPERATOR
public static final String NOT_EQUAL_OPERATOR
public static final String GREATER_THAN
public static final String GREATER_THAN_EQ
public static final String LESS_THAN
public static final String LESS_THAN_EQ
public SplunkQueryBuilder(String index)
public void addSourceType(String sourceType)
sourceType
- The Splunk Sourcetype to be added to the Splunk query.public boolean addField(String field)
field
- The field to be added to the querypublic void addLimit(int limit)
limit
- Positive, non-zero integer of number of desired rows.public void addFilter(String left, String right, String operator)
left
- The field to be filteredright
- The value of that fieldoperator
- The actual operator to go in the SPL querypublic void addNotNullFilter(String fieldName)
fieldName
- The field name which should be nullpublic void addNullFilter(String fieldName)
fieldName
- The field name which should be nullpublic void addFilters(Map<String,ExprNode.ColRelOpConstNode> filters)
filters
- A HashMap of filterspublic String quoteString(String word)
word
- The input word to be quoted.public String build()
public static boolean isNumeric(String str)
str
- The string to test for numericCopyright © 1970 The Apache Software Foundation. All rights reserved.