static gboolean tf_graphite_prepare(LogTemplateFunction *self, gpointer s, LogTemplate *parent, gint argc, gchar *argv[], GError **error) { TFGraphiteState *state = (TFGraphiteState *)s; ValuePairsTransformSet *vpts; if (!tf_graphite_parse_command_line_arguments(state, &argc, &argv, parent)) return FALSE; if (!state->timestamp_template) { state->timestamp_template = log_template_new(parent->cfg, "graphite_timestamp_template"); log_template_compile(state->timestamp_template, "$R_UNIXTIME", NULL); } state->vp = value_pairs_new_from_cmdline (parent->cfg, argc, argv, error); if (!state->vp) return FALSE; /* Always replace a leading dot with an underscore. */ vpts = value_pairs_transform_set_new(".*"); value_pairs_transform_set_add_func(vpts, value_pairs_new_transform_replace_prefix(".", "_")); value_pairs_add_transforms(state->vp, vpts); return TRUE; }
static gboolean tf_json_prepare(LogTemplateFunction *self, gpointer s, LogTemplate *parent, gint argc, gchar *argv[], GError **error) { TFJsonState *state = (TFJsonState *)s; ValuePairsTransformSet *vpts; gboolean transform_initial_dot; state->vp = value_pairs_new_from_cmdline (parent->cfg, &argc, &argv, TRUE, error); if (!state->vp) return FALSE; if (!_parse_additional_options(argc, argv, &transform_initial_dot, error)) return FALSE; if (transform_initial_dot) { /* Always replace a leading dot with an underscore. */ vpts = value_pairs_transform_set_new(".*"); value_pairs_transform_set_add_func(vpts, value_pairs_new_transform_replace_prefix(".", "_")); value_pairs_add_transforms(state->vp, vpts); } return TRUE; }