Go to the source code of this file.
Data Structures | |
struct | grok_pattern |
struct | grok |
Typedefs | |
typedef struct grok | grok_t |
typedef struct grok_pattern | grok_pattern_t |
Functions | |
grok_t * | grok_new () |
Create a new grok_t instance. | |
void | grok_init (grok_t *grok) |
Initialize a grok_t instance. | |
void | grok_clone (grok_t *dst, const grok_t *src) |
Shallow clone of a grok instance. | |
void | grok_free (grok_t *grok) |
Free a grok instance. | |
void | grok_free_clone (const grok_t *grok) |
const char * | grok_version () |
Get the library's version number. | |
int | grok_compile (grok_t *grok, const char *pattern) |
Compile a pattern. | |
int | grok_compilen (grok_t *grok, const char *pattern, int length) |
Compile a pattern with known length. | |
int | grok_exec (const grok_t *grok, const char *text, grok_match_t *gm) |
Execute against a string input. | |
int | grok_execn (const grok_t *grok, const char *text, int textlen, grok_match_t *gm) |
int | grok_match_get_named_substring (const grok_match_t *gm, const char *name, const char **substr, int *len) |
Variables | |
int | g_grok_global_initialized |
pcre * | g_pattern_re |
int | g_pattern_num_captures |
int | g_cap_name |
int | g_cap_pattern |
int | g_cap_subname |
int | g_cap_predicate |
Shallow clone of a grok instance.
This is useful for creating new grok_t instances with the same loaded patterns. It also copies the log settings.
dst | pointer to destination grok_t you want to clone into. | |
src | pointer to source grok_t you can to clone from. |
int grok_compile | ( | grok_t * | grok, | |
const char * | pattern | |||
) |
Compile a pattern.
PCRE syntax is supported.
Grok extends this syntax with %{PATTERN} syntax This allows you to use predefined patterns anywhere in your regular expression.
grok | the grok_t instance to compile into. | |
pattern | the string regexp pattern to compile. |
int grok_compilen | ( | grok_t * | grok, | |
const char * | pattern, | |||
int | length | |||
) |
Compile a pattern with known length.
pattern | the string pattern to compile | |
length | the length of the pattern |
int grok_exec | ( | const grok_t * | grok, | |
const char * | text, | |||
grok_match_t * | gm | |||
) |
Execute against a string input.
text | the text to match. | |
gm | The grok_match_t to store match result in. If NULL, no storing is attempted. |
int grok_execn | ( | const grok_t * | grok, | |
const char * | text, | |||
int | textlen, | |||
grok_match_t * | gm | |||
) |
void grok_free | ( | grok_t * | grok | ) |
void grok_init | ( | grok_t * | grok | ) |
Initialize a grok_t instance.
This is useful if you have a grok_t as a stack variable rather than heap.
grok_t* grok_new | ( | ) |
Create a new grok_t instance.
The new grok_t instance is initialized with grok_init() already, so you do not need to call it.
You should use grok_free() on the result when you want to free it.
const char* grok_version | ( | ) |
Get the library's version number.