<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html><head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="generator" content="Osso Notes">
<title></title></head>
<body>
<p>----- Original message -----
<br>> This implements very basic support for type hinting template strings,
<br>> where those hints will be available to value-pairs too, allowing any
<br>> user of either LogTemplate or value-pairs to handle different types of
<br>> values than plain strings. How they handle it, is up to the callers,
<br>> this patch just lays the groundwork that makes it possible to pass
<br>> these hints around.
<br>>
<br>> There are a few not terribly nice solutions here, namely that the type
<br>> information is encoded into the first byte of the value we store while
<br>> building the value-pairs set: we do this to avoid having to allocate
<br>> memory separately: we'll just reuse a byte from a ScratchBuffer. This,
<br>> however, is done behind the scenes, the callback functions will get
<br>> the type and value information separately.
<br>>
<br>> Signed-off-by: Gergely Nagy <<a href="mailto:algernon@balabit.hu">algernon@balabit.hu</a>>
<br>> ---
<br>>  lib/cfg-grammar.y  |  41 ++++++++++++++++++++++---
<br>>  lib/cfg-lexer.h  |  5 +++
<br>>  lib/filter-expr-grammar.ym  |  18 ++++++++---
<br>>  lib/templates.c  |  28 +++++++++++++++++
<br>>  lib/templates.h  |  13 ++++++++
<br>>  lib/value-pairs.c  |  67
<br>> +++++++++++++++++++++++++++++++++-------- lib/value-pairs.h  
<br>> |  8 +++-- modules/afamqp/afamqp.c  |  3 +-
<br>>  modules/afmongodb/afmongodb.c |  2 +-
<br>>  modules/json/format-json.c  |  3 +-
<br>>  tests/unit/test_value_pairs.c |  6 ++--
<br>>  11 files changed, 164 insertions(+), 30 deletions(-)
<br>>
<br>> diff --git a/lib/cfg-grammar.y b/lib/cfg-grammar.y
<br>> index f45d486..a275aa6 100644
<br>> --- a/lib/cfg-grammar.y
<br>> +++ b/lib/cfg-grammar.y
<br>> @@ -370,6 +370,8 @@ ValuePairsTransformSet *last_vp_transset;
<br>>  %type <ptr> dest_item
<br>>  %type  <ptr> dest_plugin
<br>>  
<br>> +%type  <tpl> template_content
<br>> +
<br>>  %type  <ptr> filter_content
<br>>  
<br>>  %type  <ptr> parser_content
<br>> @@ -709,12 +711,23 @@ template_items
<br>>   |
<br>>   ;
<br>>  
<br>> +/* START_RULES */
<br>> +
<br>> +template_content
<br>> +  : string  { $$.str = $1; $$.typehint =
<br>> NULL; } +  | LL_IDENTIFIER '(' string ')'  { $$.str = $3;
<br>> $$.typehint = $1; } +  ;
<br>> +
<br>
<br>can't we move template compilation here somehow? e.g. return logtemplate as a ptr?
<br>
<br>> +/* END_RULES */
<br>> +
<br>>  template_item
<br>> - : KW_TEMPLATE '(' string ')' {
<br>> + : KW_TEMPLATE '(' template_content ')' {
<br>>  GError *error = NULL;
<br>>  
<br>> -  
<br>> CHECK_ERROR(log_template_compile(last_template, $3, &error), @3, "Error
<br>> compiling template (%s)", error->message); -  
<br>>  free($3); +  
<br>>  CHECK_ERROR(log_template_compile(last_template, $3.str,
<br>> &error), @3, "Error compiling template (%s)", error->message); +  
<br>>  free($3.str); +  
<br>>  
<br>> CHECK_ERROR(log_template_set_type_hint(last_template, $3.typehint,
<br>> &error), @3, "Error setting the template type-hint (%s)",
<br>> error->message); +  
<br>> g_free($3.typehint);  }
<br>
<br>that way this code would be there
<br>
<br>> | KW_TEMPLATE_ESCAPE '(' yesno ')' {
<br>> log_template_set_escape(last_template, $3); } ; @@ -1065,8 +1078,26 @@
<br>> vp_options ;  vp_option -  : KW_PAIR '(' string ':' string ')'  
<br>>  { value_pairs_add_pair(last_value_pairs, configuration, $3, $5);
<br>> free($3); free($5); } -  | KW_PAIR '(' string string ')'  
<br>> { value_pairs_add_pair(last_value_pairs, configuration, $3, $4);
<br>> free($3); free($4); } +  : KW_PAIR '(' string ':' template_content
<br>> ')' +  { +  GError *error = NULL; + +  
<br>> CHECK_ERROR(value_pairs_add_pair_with_type(last_value_pairs,
<br>> configuration, $3, $5.typehint, $5.str, &error), +  
<br>> @5, "Error processing value-pair (%s)", error->message); +  
<br>> free($3); +  g_free($5.typehint); +  free($5.str);
<br>> +  }
<br>> +  | KW_PAIR '(' string template_content ')'
<br>> +  {
<br>> +  GError *error = NULL;
<br>> +
<br>> +  CHECK_ERROR(value_pairs_add_pair_with_type(last_value_pairs,
<br>> configuration, $3, $4.typehint, $4.str, &error), +  
<br>> @4, "Error processing value-pair (%s)", error->message); +  
<br>> free($3); +  g_free($4.typehint);
<br>> +  free($4.str);
<br>> +  }
<br>
<br>and these dupes would be gone.
<br>
<br>>  | KW_KEY '(' string KW_REKEY '('
<br>>  {
<br>>  last_vp_transset = value_pairs_transform_set_new($3);
<br>> diff --git a/lib/cfg-lexer.h b/lib/cfg-lexer.h
<br>> index 03c8a61..2030b66 100644
<br>> --- a/lib/cfg-lexer.h
<br>> +++ b/lib/cfg-lexer.h
<br>> @@ -65,6 +65,11 @@ typedef struct YYSTYPE
<br>>  char *cptr;
<br>>  void *ptr;
<br>>  gpointer node;
<br>> +  struct
<br>> +  {
<br>> +  gchar *str;
<br>> +  gchar *typehint;
<br>> +  } tpl;
<br>>  };
<br>>  } YYSTYPE;
<br>>  #define YYSTYPE_IS_TRIVIAL 1
<br>> diff --git a/lib/filter-expr-grammar.ym b/lib/filter-expr-grammar.ym
<br>> index 1efa651..0a61df2 100644
<br>> --- a/lib/filter-expr-grammar.ym
<br>> +++ b/lib/filter-expr-grammar.ym
<br>> @@ -174,7 +174,7 @@ filter_simple_expr
<br>>  }
<br>>  $$ = node;
<br>>  }
<br>> - | string operator string
<br>> + | template_content operator template_content
<br>>  {
<br>>  LogTemplate *left, *right;
<br>>  GError *error = NULL;
<br>> @@ -182,13 +182,21 @@ filter_simple_expr
<br>>  
<br>>  left = log_template_new(configuration, NULL);
<br>>  right = log_template_new(configuration, NULL);
<br>> -  success_left = log_template_compile(left, $1, &error);
<br>> -  success_right = log_template_compile(right, $3, &error);
<br>> -  free($1);
<br>> -  free($3);
<br>> +  success_left = log_template_compile(left, $1.str, &error);
<br>> +  success_right = log_template_compile(right, $3.str, &error);
<br>> +  free($1.str);
<br>> +  free($3.str);
<br>>  CHECK_ERROR(success_left, @1, "error compiling template:
<br>> %s", error->message);  CHECK_ERROR(success_right, @3, "error
<br>> compiling template: %s", error->message);
<br>> +  CHECK_ERROR(log_template_set_type_hint(left, $1.typehint,
<br>> &error), @1, "error setting type hint on template: %s", error->message);
<br>> +  CHECK_ERROR(log_template_set_type_hint(right, $3.typehint,
<br>> &error), @3, "error setting type hint on template: %s", error->message);
<br>> + +  CHECK_ERROR(left->type_hint == right->type_hint, @$,
<br>> "template types (%s <-> %s) do not match", $1.typehint, $3.typehint); +
<br>> +  g_free($1.typehint); +  g_free($3.typehint);
<br>> +
<br>>  $$ = fop_cmp_new(left, right, $2);
<br>
<br>most of these would be gone too.
<br>
<br>>  }
<br>>  ;
<br>> diff --git a/lib/templates.c b/lib/templates.c
<br>> index f62f8b8..9be8110 100644
<br>> --- a/lib/templates.c
<br>> +++ b/lib/templates.c
<br>> @@ -886,6 +886,34 @@ parse_msg_ref(gchar **p, gint *msg_ref)
<br>>  }
<br>>  
<br>>  gboolean
<br>> +log_template_set_type_hint(LogTemplate *self, const gchar *hint, GError
<br>> **error) +{
<br>> +  if (hint == NULL)
<br>> +  return TRUE;
<br>> +
<br>> +  if (strcmp(hint, "string") == 0)
<br>> +  self->type_hint = TEMPLATE_TYPE_STRING;
<br>> +  else if (strcmp(hint, "int32") == 0 || strcmp(hint, "int") == 0)
<br>> +  self->type_hint = TEMPLATE_TYPE_INT32;
<br>> +  else if (strcmp(hint, "int64") == 0)
<br>> +  self->type_hint = TEMPLATE_TYPE_INT64;
<br>> +  else if (strcmp(hint, "datetime") == 0)
<br>> +  self->type_hint = TEMPLATE_TYPE_DATETIME;
<br>> +  else if (strcmp(hint, "boolean") == 0)
<br>> +  self->type_hint = TEMPLATE_TYPE_BOOLEAN;
<br>> +  else if (strcmp(hint, "default") == 0)
<br>> +  self->type_hint = TEMPLATE_TYPE_DEFAULT;
<br>> +  else
<br>> +  {
<br>> +  g_set_error(error, LOG_TEMPLATE_ERROR, LOG_TEMPLATE_ERROR_TYPE,
<br>> +  "%s", hint);
<br>> +  return FALSE;
<br>> +  }
<br>> +
<br>> +  return TRUE;
<br>> +}
<br>
<br>I'm thinking about whether it'd make sense to configure this at runtime, and whether the list of supported values could be destination specific.
<br>
<br>> +
<br>> +gboolean
<br>>  log_template_compile(LogTemplate *self, const gchar *template, GError
<br>> **error) {
<br>>  gchar *start, *p;
<br>> diff --git a/lib/templates.h b/lib/templates.h
<br>> index ed5b688..f3ad226 100644
<br>> --- a/lib/templates.h
<br>> +++ b/lib/templates.h
<br>> @@ -40,8 +40,19 @@ enum LogTemplateError
<br>>  {
<br>>  LOG_TEMPLATE_ERROR_FAILED,
<br>>  LOG_TEMPLATE_ERROR_COMPILE,
<br>> +  LOG_TEMPLATE_ERROR_TYPE,
<br>>  };
<br>>  
<br>> +typedef enum
<br>> +{
<br>> +  TEMPLATE_TYPE_STRING,
<br>> +  TEMPLATE_TYPE_BOOLEAN,
<br>> +  TEMPLATE_TYPE_INT32,
<br>> +  TEMPLATE_TYPE_INT64,
<br>> +  TEMPLATE_TYPE_DATETIME,
<br>> +  TEMPLATE_TYPE_DEFAULT,
<br>> +} LogTemplateType;
<br>> +
<br>
<br>default is somehow an exception here.
<br>
<br>>  /* structure that represents an expandable syslog-ng template */
<br>>  typedef struct _LogTemplate
<br>>  {
<br>> @@ -54,6 +65,7 @@ typedef struct _LogTemplate
<br>>  GlobalConfig *cfg;
<br>>  GStaticMutex arg_lock;
<br>>  GPtrArray *arg_bufs;
<br>> +  LogTemplateType type_hint;
<br>>  } LogTemplate;
<br>>  
<br>>  /* template expansion options that can be influenced by the user and
<br>> @@ -189,6 +201,7 @@ void tf_simple_func_free_state(gpointer state);
<br>>  
<br>>  void log_template_set_escape(LogTemplate *self, gboolean enable);
<br>>  gboolean log_template_compile(LogTemplate *self, const gchar *template,
<br>> GError **error); +gboolean log_template_set_type_hint(LogTemplate *self,
<br>> const gchar *hint, GError **error); void log_template_format(LogTemplate
<br>> *self, LogMessage *lm, LogTemplateOptions *opts, gint tz, gint32
<br>> seq_num, const gchar *context_id, GString *result); void
<br>> log_template_append_format(LogTemplate *self, LogMessage *lm,
<br>> LogTemplateOptions *opts, gint tz, gint32 seq_num, const gchar
<br>> *context_id, GString *result); void
<br>> log_template_append_format_with_context(LogTemplate *self, LogMessage
<br>> **messages, gint num_messages, LogTemplateOptions *opts, gint tz, gint32
<br>> seq_num, const gchar *context_id, GString *result); diff --git
<br>> a/lib/value-pairs.c b/lib/value-pairs.c index ee22b73..da2e391 100644
<br>> --- a/lib/value-pairs.c +++ b/lib/value-pairs.c @@ -151,16 +151,30 @@
<br>> value_pairs_add_glob_pattern(ValuePairs *vp, const gchar *pattern,  
<br>> vp->patterns[i] = p; }  -void -value_pairs_add_pair(ValuePairs *vp,
<br>> GlobalConfig *cfg, const gchar *key, const gchar *value) +gboolean
<br>> +value_pairs_add_pair_with_type(ValuePairs *vp, GlobalConfig *cfg,
<br>> +  const gchar *key, const gchar *type,
<br>> +  const gchar *value, GError **error)
<br>>  {
<br>>  VPPairConf *p = g_new(VPPairConf, 1);
<br>>  
<br>>  p->name = g_strdup(key);
<br>>  p->template = log_template_new(cfg, NULL);
<br>> -  log_template_compile(p->template, value, NULL);
<br>> +  log_template_compile(p->template, value, error);
<br>> +  if (error && *error)
<br>> +  return FALSE;
<br>> +  log_template_set_type_hint(p->template, type, error);
<br>> +  if (error && *error)
<br>> +  return FALSE;
<br>>  
<br>>  g_ptr_array_add(vp->vpairs, p);
<br>> +  return TRUE;
<br>> +}
<br>> +
<br>> +void
<br>> +value_pairs_add_pair(ValuePairs *vp, GlobalConfig *cfg, const gchar
<br>> *key, const gchar *value) +{
<br>> +  value_pairs_add_pair_with_type(vp, cfg, key, NULL, value, NULL);
<br>>  }
<br>>  
<br>>  static gchar *
<br>> @@ -185,6 +199,13 @@ vp_transform_apply (ValuePairs *vp, gchar *key)
<br>>  return ckey;
<br>>  }
<br>>  
<br>> +static GString *
<br>> +vp_pairs_typehint(GString *str, LogTemplateType type_hint)
<br>> +{
<br>> +  g_string_append_printf(str, "%c", type_hint);
<br>> +  return str;
<br>> +}
<br>> +
<br>>  /* runs over the name-value pairs requested by the user (e.g. with
<br>> value_pairs_add_pair) */ static void
<br>>  vp_pairs_foreach(gpointer data, gpointer user_data)
<br>> @@ -196,10 +217,11 @@ vp_pairs_foreach(gpointer data, gpointer user_data)
<br>>  ScratchBuffer *sb = scratch_buffer_acquire();
<br>>  VPPairConf *vpc = (VPPairConf *)data;
<br>>  
<br>> -  log_template_format((LogTemplate *)vpc->template, msg, NULL,
<br>> LTZ_LOCAL, -  seq_num, NULL, sb_string(sb));
<br>> +  vp_pairs_typehint(sb_string(sb), vpc->template->type_hint);
<br>> +  log_template_append_format((LogTemplate *)vpc->template, msg, NULL,
<br>> LTZ_LOCAL, +  seq_num, NULL, sb_string(sb));
<br>>  
<br>> -  if (!sb_string(sb)->str[0])
<br>> +  if (sb_string(sb)->len == 0)
<br>>  {
<br>>  scratch_buffer_release(sb);
<br>>  return;
<br>> @@ -234,8 +256,13 @@ vp_msg_nvpairs_foreach(NVHandle handle, gchar *name,
<br>>  (log_msg_is_handle_sdata(handle) && (vp->scopes & VPS_SDATA))) ||
<br>>  inc)
<br>>  {
<br>> +  gchar *v = g_malloc(value_len + 2);
<br>> +
<br>>  /* NOTE: the key is a borrowed reference in the hash, and value
<br>> is freed */ -  g_tree_insert(scope_set, vp_transform_apply(vp,
<br>> name), g_strndup(value, value_len)); +  v[0] = 0;
<br>> +  strncpy(v + 1, value, value_len);
<br>> +  v[value_len + 1] = 0;
<br>> +  g_tree_insert(scope_set, vp_transform_apply(vp, name), v);
<br>>  }
<br>>  
<br>>  return FALSE;
<br>> @@ -265,6 +292,7 @@ vp_merge_set(ValuePairs *vp, LogMessage *msg, gint32
<br>> seq_num, ValuePairSpec *set  switch (set[i].type)
<br>>  {
<br>>  case VPT_MACRO:
<br>> +  vp_pairs_typehint(sb_string(sb), TEMPLATE_TYPE_STRING);
<br>>  log_macro_expand(sb_string(sb), set[i].id, FALSE, NULL,
<br>> LTZ_LOCAL, seq_num, NULL, msg);  break;
<br>>  case VPT_NVPAIR:
<br>> @@ -272,6 +300,7 @@ vp_merge_set(ValuePairs *vp, LogMessage *msg, gint32
<br>> seq_num, ValuePairSpec *set  const gchar *nv;
<br>>  gssize len;
<br>>  
<br>> +  vp_pairs_typehint(sb_string(sb), TEMPLATE_TYPE_STRING);
<br>>  nv = log_msg_get_value(msg, (NVHandle) set[i].id, &len);
<br>>  g_string_append_len(sb_string(sb), nv, len);
<br>>  break;
<br>> @@ -280,7 +309,7 @@ vp_merge_set(ValuePairs *vp, LogMessage *msg, gint32
<br>> seq_num, ValuePairSpec *set  g_assert_not_reached();
<br>>  }
<br>>  
<br>> -  if (!sb_string(sb)->str[0])
<br>> +  if (sb_string(sb)->len == 0)
<br>>   continue;
<br>>  
<br>>  g_tree_insert(dest, vp_transform_apply(vp, set[i].name),
<br>> sb_string(sb)->str); @@ -289,12 +318,22 @@ vp_merge_set(ValuePairs *vp,
<br>> LogMessage *msg, gint32 seq_num, ValuePairSpec *set  
<br>> scratch_buffer_release(sb); }
<br>>  
<br>> +static gboolean
<br>> +vp_foreach_helper (const gchar *name, const gchar *hinted_value,
<br>> gpointer data) +{
<br>> +  VPForeachFunc func = ((gpointer *)data)[0];
<br>> +  gpointer user_data = ((gpointer *)data)[1];
<br>> +
<br>> +  return func(name, (LogTemplateType)hinted_value[0], hinted_value + 1,
<br>> user_data); +}
<br>> +
<br>>  void
<br>>  value_pairs_foreach_sorted (ValuePairs *vp, VPForeachFunc func,
<br>>  GCompareDataFunc compare_func,
<br>>  LogMessage *msg, gint32 seq_num, gpointer
<br>> user_data) {
<br>>  gpointer args[] = { vp, func, msg, GINT_TO_POINTER (seq_num),
<br>> user_data, NULL }; +  gpointer helper_args[] = { func, user_data };
<br>>  GTree *scope_set;
<br>>  
<br>>  scope_set = g_tree_new_full((GCompareDataFunc)compare_func, NULL,
<br>> @@ -326,7 +365,7 @@ value_pairs_foreach_sorted (ValuePairs *vp,
<br>> VPForeachFunc func,  g_ptr_array_foreach(vp->vpairs,
<br>> (GFunc)vp_pairs_foreach, args);
<br>>  /* Aaand we run it through the callback! */
<br>> -  g_tree_foreach(scope_set, (GTraverseFunc)func, user_data);
<br>> +  g_tree_foreach(scope_set, (GTraverseFunc)vp_foreach_helper,
<br>> helper_args);
<br>>  g_tree_destroy(scope_set);
<br>>  }
<br>> @@ -481,7 +520,7 @@ vp_walker_name_split(vp_walk_stack_t **stack,
<br>> vp_walk_state_t *state, }
<br>>  
<br>>  static gboolean
<br>> -value_pairs_walker(const gchar *name, const gchar *value,
<br>> +value_pairs_walker(const gchar *name, LogTemplateType type, const gchar
<br>> *value,  gpointer user_data)
<br>>  {
<br>>  vp_walk_state_t *state = (vp_walk_state_t *)user_data;
<br>> @@ -494,10 +533,14 @@ value_pairs_walker(const gchar *name, const gchar
<br>> *value,  key = vp_walker_name_split (&st, state, name);
<br>>  
<br>>  if (st)
<br>> -  result = state->process_value(key, st->prefix, value, &st->data,
<br>> +  result = state->process_value(key, st->prefix,
<br>> +  type, value,
<br>> +  &st->data,
<br>>  state->user_data);
<br>>  else
<br>> -  result = state->process_value(key, NULL, value, NULL,
<br>> +  result = state->process_value(key, NULL,
<br>> +  type, value,
<br>> +  NULL,
<br>>  state->user_data);
<br>>  
<br>>  g_free(key);
<br>> diff --git a/lib/value-pairs.h b/lib/value-pairs.h
<br>> index a6c9f34..0438d53 100644
<br>> --- a/lib/value-pairs.h
<br>> +++ b/lib/value-pairs.h
<br>> @@ -27,12 +27,13 @@
<br>>  
<br>>  #include "syslog-ng.h"
<br>>  #include "nvtable.h"
<br>> +#include "templates.h"
<br>>  
<br>>  typedef struct _ValuePairs ValuePairs;
<br>> -typedef gboolean (*VPForeachFunc)(const gchar *name, const gchar
<br>> *value, gpointer user_data); +typedef gboolean (*VPForeachFunc)(const
<br>> gchar *name, LogTemplateType type, const gchar *value, gpointer
<br>> user_data);  typedef gboolean (*VPWalkValueCallbackFunc)(const gchar
<br>> *name, const gchar *prefix, -  
<br>> const gchar *value, +  
<br>> LogTemplateType type, const gchar *value,  
<br>>  gpointer *prefix_data, gpointer user_data); typedef
<br>> gboolean (*VPWalkCallbackFunc)(const gchar *name,  
<br>>  const gchar *prefix, gpointer *prefix_data, @@ -42,6
<br>> +43,9 @@ typedef gboolean (*VPWalkCallbackFunc)(const gchar *name,
<br>> gboolean value_pairs_add_scope(ValuePairs *vp, const gchar *scope); void
<br>> value_pairs_add_glob_pattern(ValuePairs *vp, const gchar *pattern,
<br>> gboolean include); void value_pairs_add_pair(ValuePairs *vp,
<br>> GlobalConfig *cfg, const gchar *key, const gchar *value); +gboolean
<br>> value_pairs_add_pair_with_type(ValuePairs *vp, GlobalConfig *cfg, +  
<br>>  const gchar *key, const gchar *type, +
<br>>  const gchar *value, GError
<br>> **error);  void value_pairs_add_transforms(ValuePairs *vp, gpointer
<br>> vpts);  diff --git a/modules/afamqp/afamqp.c b/modules/afamqp/afamqp.c
<br>> index 70fd3e8..fb3a333 100644
<br>> --- a/modules/afamqp/afamqp.c
<br>> +++ b/modules/afamqp/afamqp.c
<br>> @@ -374,7 +374,8 @@ afamqp_dd_connect(AMQPDestDriver *self, gboolean
<br>> reconnect)  */
<br>>  
<br>>  static gboolean
<br>> -afamqp_vp_foreach(const gchar *name, const gchar *value,
<br>> +afamqp_vp_foreach(const gchar *name,
<br>> +  LogTemplateType type, const gchar *value,
<br>>  gpointer user_data)
<br>>  {
<br>>  amqp_table_entry_t **entries = (amqp_table_entry_t **) ((gpointer
<br>> *)user_data)[0]; diff --git a/modules/afmongodb/afmongodb.c
<br>> b/modules/afmongodb/afmongodb.c index 9779097..5230d8f 100644
<br>> --- a/modules/afmongodb/afmongodb.c
<br>> +++ b/modules/afmongodb/afmongodb.c
<br>> @@ -359,7 +359,7 @@ afmongodb_vp_obj_end(const gchar *name,
<br>>  
<br>>  static gboolean
<br>>  afmongodb_vp_process_value(const gchar *name, const gchar *prefix,
<br>> -  const gchar *value,
<br>> +  LogTemplateType type, const gchar *value,
<br>>  gpointer *prefix_data, gpointer user_data)
<br>>  {
<br>>  bson *o;
<br>> diff --git a/modules/json/format-json.c b/modules/json/format-json.c
<br>> index d654c2e..4b79701 100644
<br>> --- a/modules/json/format-json.c
<br>> +++ b/modules/json/format-json.c
<br>> @@ -163,7 +163,8 @@ tf_json_obj_end(const gchar *name,
<br>>  }
<br>>  
<br>>  static gboolean
<br>> -tf_json_value(const gchar *name, const gchar *prefix, const gchar
<br>> *value, +tf_json_value(const gchar *name, const gchar *prefix,
<br>> +  LogTemplateType type, const gchar *value,
<br>>  gpointer *prefix_data, gpointer user_data)
<br>>  {
<br>>  json_state_t *state = (json_state_t *)user_data;
<br>> diff --git a/tests/unit/test_value_pairs.c
<br>> b/tests/unit/test_value_pairs.c index ca4ba32..3fe09de 100644
<br>> --- a/tests/unit/test_value_pairs.c
<br>> +++ b/tests/unit/test_value_pairs.c
<br>> @@ -10,7 +10,7 @@
<br>>  gboolean success = TRUE;
<br>>  
<br>>  gboolean
<br>> -vp_keys_foreach(const gchar  *name, const gchar *value, gpointer
<br>> user_data) +vp_keys_foreach(const gchar  *name, LogTemplateType type,
<br>> const gchar *value, gpointer user_data) {
<br>>  gpointer *args = (gpointer *) user_data;
<br>>  GList **keys = (GList **) args[0];
<br>> @@ -123,7 +123,7 @@ main(int argc, char *argv[])
<br>>  
<br>>  testcase("all-nv-pairs", NULL,
<br>> "<a href="mailto:.SDATA.EventData@18372.4.Data">.SDATA.EventData@18372.4.Data</a>,<a href="mailto:.SDATA.Keywords@18372.4.Keyword">.SDATA.Keywords@18372.4.Keyword</a>,.SDATA.meta.sequenceId,.SDATA.meta.sysUpTime,.SDATA.origin.ip,HOST,MESSAGE,MSGID,PID,PROGRAM",
<br>> NULL);  -  testcase("everything", NULL,
<br>> "<a href="mailto:.SDATA.EventData@18372.4.Data">.SDATA.EventData@18372.4.Data</a>,<a href="mailto:.SDATA.Keywords@18372.4.Keyword">.SDATA.Keywords@18372.4.Keyword</a>,.SDATA.meta.sequenceId,.SDATA.meta.sysUpTime,.SDATA.origin.ip,AMPM,BSDTAG,C_DATE,C_DAY,C_FULLDATE,C_HOUR,C_ISODATE,C_MIN,C_MONTH,C_MONTH_ABBREV,C_MONTH_NAME,C_MONTH_WEEK,C_SEC,C_STAMP,C_TZ,C_T ZOFFSET,C_UNIXTIME,C_WEEK,C_WEEKDAY,C_WEEK_DAY,C_WEEK_DAY_ABBREV,C_WEEK_DAY_NAME,C_YEAR,C_YEAR_DAY,DATE,DAY,FACILITY,FACILITY_NUM,FULLDATE,HOST,HOUR,HOUR12,ISODATE,LEVEL,LEVEL_NUM,LOGHOST,MESSAGE,MIN,MONTH,MONTH_ABBREV,MONTH_NAME,MONTH_WEEK,MSEC,MSG,MSGHDR ,MSGID,PID,PRI,PRIORITY,PROGRAM,R_AMPM,R_DATE,R_DAY,R_FULLDATE,R_HOUR,R_HOUR12,R_ISODATE,R_MIN,R_MONTH,R_MONTH_ABBREV,R_MONTH_NAME,R_MONTH_WEEK,R_MSEC,R_SEC,R_STAMP,R_TZ,R_TZOFFSET,R_UNIXTIME,R_USEC,R_WEEK,R_WEEKDAY,R_WEEK_DAY,R_WEEK_DAY_ABBREV,R_WEEK_DAY_ NAME,R_YEAR,R_YEAR_DAY,SDATA,SEC,SEQNUM,SOURCEIP,STAMP,SYSUPTIME,S_AMPM,S_DATE,S_DAY,S_FULLDATE,S_HOUR,S_HOUR12,S_ISODATE,S_MIN,S_MONTH,S_MONTH_ABBREV,S_MONTH_NAME,S_MONTH_WEEK,S_MSEC,S_SEC,S
<br>> _STAMP,S
<br>> _TZ,S_TZOFFSET,S_UNIXTIME,S_USEC,S_WEEK,S_WEEKDAY,S_WEEK_DAY,S_WEEK_DAY_ABBREV,S_WEEK_DAY_NAME,S_YEAR,S_YEAR_DAY,TAG,TAGS,TZ,TZOFFSET,UNIXTIME,USEC,WEEK,WEEKDAY,WEEK_DAY,WEEK_DAY_ABBREV,WEEK_DAY_NAME,YEAR,YEAR_DAY",
<br>> NULL); +  testcase("everything", NULL,
<br>> "<a href="mailto:.SDATA.EventData@18372.4.Data">.SDATA.EventData@18372.4.Data</a>,<a href="mailto:.SDATA.Keywords@18372.4.Keyword">.SDATA.Keywords@18372.4.Keyword</a>,.SDATA.meta.sequenceId,.SDATA.meta.sysUpTime,.SDATA.origin.ip,AMPM,BSDTAG,CONTEXT_ID,C_DATE,C_DAY,C_FULLDATE,C_HOUR,C_ISODATE,C_MIN,C_MONTH,C_MONTH_ABBREV,C_MONTH_NAME,C_MONTH_WEEK,C_SEC,C_STA MP,C_TZ,C_TZOFFSET,C_UNIXTIME,C_WEEK,C_WEEKDAY,C_WEEK_DAY,C_WEEK_DAY_ABBREV,C_WEEK_DAY_NAME,C_YEAR,C_YEAR_DAY,DATE,DAY,FACILITY,FACILITY_NUM,FULLDATE,HOST,HOUR,HOUR12,ISODATE,LEVEL,LEVEL_NUM,LOGHOST,MESSAGE,MIN,MONTH,MONTH_ABBREV,MONTH_NAME,MONTH_WEEK,MSEC ,MSG,MSGHDR,MSGID,PID,PRI,PRIORITY,PROGRAM,R_AMPM,R_DATE,R_DAY,R_FULLDATE,R_HOUR,R_HOUR12,R_ISODATE,R_MIN,R_MONTH,R_MONTH_ABBREV,R_MONTH_NAME,R_MONTH_WEEK,R_MSEC,R_SEC,R_STAMP,R_TZ,R_TZOFFSET,R_UNIXTIME,R_USEC,R_WEEK,R_WEEKDAY,R_WEEK_DAY,R_WEEK_DAY_ABBREV, R_WEEK_DAY_NAME,R_YEAR,R_YEAR_DAY,SDATA,SEC,SEQNUM,SOURCEIP,STAMP,SYSUPTIME,S_AMPM,S_DATE,S_DAY,S_FULLDATE,S_HOUR,S_HOUR12,S_ISODATE,S_MIN,S_MONTH,S_MONTH_ABBREV,S_MONTH_NAME,S_MONTH_WEEK,S_M
<br>> SEC,S_SE
<br>> C,S_STAMP,S_TZ,S_TZOFFSET,S_UNIXTIME,S_USEC,S_WEEK,S_WEEKDAY,S_WEEK_DAY,S_WEEK_DAY_ABBREV,S_WEEK_DAY_NAME,S_YEAR,S_YEAR_DAY,TAG,TAGS,TZ,TZOFFSET,UNIXTIME,USEC,WEEK,WEEKDAY,WEEK_DAY,WEEK_DAY_ABBREV,WEEK_DAY_NAME,YEAR,YEAR_DAY",
<br>> NULL);  testcase("nv-pairs", ".SDATA.*",
<br>> "HOST,MESSAGE,MSGID,PID,PROGRAM", NULL);  @@ -139,7 +139,7 @@ main(int
<br>> argc, char *argv[])  g_ptr_array_add(transformers,
<br>> value_pairs_new_transform_shift(2));  g_ptr_array_add(transformers,
<br>> value_pairs_new_transform_replace("C_", "CC_"));
<br>> -  testcase("everything", NULL,
<br>> "<a href="mailto:.SDATA.EventData@18372.4.Data">.SDATA.EventData@18372.4.Data</a>,<a href="mailto:.SDATA.Keywords@18372.4.Keyword">.SDATA.Keywords@18372.4.Keyword</a>,.SDATA.meta.sequenceId,.SDATA.meta.sysUpTime,.SDATA.origin.ip,AMPM,BSDTAG,CC_DATE,CC_DAY,CC_FULLDATE,CC_HOUR,CC_ISODATE,CC_MIN,CC_MONTH,CC_MONTH_ABBREV,CC_MONTH_NAME,CC_MONTH_WEEK,CC_SEC,CC_ST AMP,CC_TZ,CC_TZOFFSET,CC_UNIXTIME,CC_WEEK,CC_WEEKDAY,CC_WEEK_DAY,CC_WEEK_DAY_ABBREV,CC_WEEK_DAY_NAME,CC_YEAR,CC_YEAR_DAY,DATE,DAY,FACILITY,FACILITY_NUM,FULLDATE,HOST,HOUR,HOUR12,ISODATE,LEVEL,LEVEL_NUM,LOGHOST,MESSAGE,MIN,MONTH,MONTH_ABBREV,MONTH_NAME,MONT H_WEEK,MSEC,MSG,MSGHDR,MSGID,PID,PRI,PRIORITY,PROGRAM,R_AMPM,R_DATE,R_DAY,R_FULLDATE,R_HOUR,R_HOUR12,R_ISODATE,R_MIN,R_MONTH,R_MONTH_ABBREV,R_MONTH_NAME,R_MONTH_WEEK,R_MSEC,R_SEC,R_STAMP,R_TZ,R_TZOFFSET,R_UNIXTIME,R_USEC,R_WEEK,R_WEEKDAY,R_WEEK_DAY,R_WEEK_ DAY_ABBREV,R_WEEK_DAY_NAME,R_YEAR,R_YEAR_DAY,SDATA,SEC,SEQNUM,SOURCEIP,STAMP,SYSUPTIME,S_AMPM,S_DATE,S_DAY,S_FULLDATE,S_HOUR,S_HOUR12,S_ISODATE,S_MIN,S_MONTH,S_MONTH_ABBREV,S_MONTH_NAME,S_MON
<br>> TH_WEEK,
<br>> S_MSEC,S_SEC,S_STAMP,S_TZ,S_TZOFFSET,S_UNIXTIME,S_USEC,S_WEEK,S_WEEKDAY,S_WEEK_DAY,S_WEEK_DAY_ABBREV,S_WEEK_DAY_NAME,S_YEAR,S_YEAR_DAY,TAG,TAGS,TZ,TZOFFSET,UNIXTIME,USEC,WEEK,WEEKDAY,WEEK_DAY,WEEK_DAY_ABBREV,WEEK_DAY_NAME,YEAR,YEAR_DAY",
<br>> transformers); +  testcase("everything", NULL,
<br>> "<a href="mailto:.SDATA.EventData@18372.4.Data">.SDATA.EventData@18372.4.Data</a>,<a href="mailto:.SDATA.Keywords@18372.4.Keyword">.SDATA.Keywords@18372.4.Keyword</a>,.SDATA.meta.sequenceId,.SDATA.meta.sysUpTime,.SDATA.origin.ip,AMPM,BSDTAG,CC_DATE,CC_DAY,CC_FULLDATE,CC_HOUR,CC_ISODATE,CC_MIN,CC_MONTH,CC_MONTH_ABBREV,CC_MONTH_NAME,CC_MONTH_WEEK,CC_SEC,CC_ST AMP,CC_TZ,CC_TZOFFSET,CC_UNIXTIME,CC_WEEK,CC_WEEKDAY,CC_WEEK_DAY,CC_WEEK_DAY_ABBREV,CC_WEEK_DAY_NAME,CC_YEAR,CC_YEAR_DAY,CONTEXT_ID,DATE,DAY,FACILITY,FACILITY_NUM,FULLDATE,HOST,HOUR,HOUR12,ISODATE,LEVEL,LEVEL_NUM,LOGHOST,MESSAGE,MIN,MONTH,MONTH_ABBREV,MONT H_NAME,MONTH_WEEK,MSEC,MSG,MSGHDR,MSGID,PID,PRI,PRIORITY,PROGRAM,R_AMPM,R_DATE,R_DAY,R_FULLDATE,R_HOUR,R_HOUR12,R_ISODATE,R_MIN,R_MONTH,R_MONTH_ABBREV,R_MONTH_NAME,R_MONTH_WEEK,R_MSEC,R_SEC,R_STAMP,R_TZ,R_TZOFFSET,R_UNIXTIME,R_USEC,R_WEEK,R_WEEKDAY,R_WEEK_ DAY,R_WEEK_DAY_ABBREV,R_WEEK_DAY_NAME,R_YEAR,R_YEAR_DAY,SDATA,SEC,SEQNUM,SOURCEIP,STAMP,SYSUPTIME,S_AMPM,S_DATE,S_DAY,S_FULLDATE,S_HOUR,S_HOUR12,S_ISODATE,S_MIN,S_MONTH,S_MONTH_ABBREV,S_MONTH
<br>> _NAME,S_
<br>> MONTH_WEEK,S_MSEC,S_SEC,S_STAMP,S_TZ,S_TZOFFSET,S_UNIXTIME,S_USEC,S_WEEK,S_WEEKDAY,S_WEEK_DAY,S_WEEK_DAY_ABBREV,S_WEEK_DAY_NAME,S_YEAR,S_YEAR_DAY,TAG,TAGS,TZ,TZOFFSET,UNIXTIME,USEC,WEEK,WEEKDAY,WEEK_DAY,WEEK_DAY_ABBREV,WEEK_DAY_NAME,YEAR,YEAR_DAY",
<br>> transformers);  g_ptr_array_free(transformers, TRUE);  app_shutdown();
<br>> --
<br>> 1.7.10.4
<br>>
<br>>
<br>> ______________________________________________________________________________
<br>> Member info: <a href="https://lists.balabit.hu/mailman/listinfo/syslog-ng">https://lists.balabit.hu/mailman/listinfo/syslog-ng</a>
<br>> Documentation:
<br>> <a href="http://www.balabit.com/support/documentation/?product=syslog-ng">http://www.balabit.com/support/documentation/?product=syslog-ng</a> FAQ:
<br>> <a href="http://www.balabit.com/wiki/syslog-ng-faq">http://www.balabit.com/wiki/syslog-ng-faq</a>
<br>>
<br><br></p>
</body>
</html>