if ((ci->values_num != 2) || (ci->values[0].type != OCONFIG_TYPE_STRING) ||
(ci->values[1].type != OCONFIG_TYPE_STRING)) {
ERROR("Target `replace': The `%s' option requires exactly two string "
"arguments.",
ci->key);
if ((ci->values_num != 2) || (ci->values[0].type != OCONFIG_TYPE_STRING) ||
(ci->values[1].type != OCONFIG_TYPE_STRING)) {
ERROR("Target `replace': The `%s' option requires exactly two string "
"arguments.",
ci->key);
}
act = calloc(1, sizeof(*act));
if (act == NULL) {
ERROR("tr_config_add_action: calloc failed.");
}
act = calloc(1, sizeof(*act));
if (act == NULL) {
ERROR("tr_config_add_action: calloc failed.");
}
act->replacement = tr_strdup(ci->values[1].value.string);
if (act->replacement == NULL) {
ERROR("tr_config_add_action: tr_strdup failed.");
tr_action_destroy(act);
}
act->replacement = tr_strdup(ci->values[1].value.string);
if (act->replacement == NULL) {
ERROR("tr_config_add_action: tr_strdup failed.");
tr_action_destroy(act);
} /* }}} int tr_config_add_action */
static int tr_config_add_meta_action(tr_meta_data_action_t **dest, /* {{{ */
} /* }}} int tr_config_add_action */
static int tr_config_add_meta_action(tr_meta_data_action_t **dest, /* {{{ */
}
act = calloc(1, sizeof(*act));
if (act == NULL) {
ERROR("tr_config_add_meta_action: calloc failed.");
}
act = calloc(1, sizeof(*act));
if (act == NULL) {
ERROR("tr_config_add_meta_action: calloc failed.");
}
act->key = tr_strdup(ci->values[0].value.string);
if (act->key == NULL) {
ERROR("tr_config_add_meta_action: tr_strdup failed.");
tr_meta_data_action_destroy(act);
}
act->key = tr_strdup(ci->values[0].value.string);
if (act->key == NULL) {
ERROR("tr_config_add_meta_action: tr_strdup failed.");
tr_meta_data_action_destroy(act);
if (act->replacement == NULL) {
ERROR("tr_config_add_meta_action: tr_strdup failed.");
tr_meta_data_action_destroy(act);
if (act->replacement == NULL) {
ERROR("tr_config_add_meta_action: tr_strdup failed.");
tr_meta_data_action_destroy(act);
} /* }}} int tr_config_add_meta_action */
static int tr_action_invoke(tr_action_t *act_head, /* {{{ */
} /* }}} int tr_config_add_meta_action */
static int tr_action_invoke(tr_action_t *act_head, /* {{{ */
if ((may_be_empty == 0) && (buffer[0] == 0)) {
WARNING("Target `replace': Replacement resulted in an empty string, "
"which is not allowed for this buffer (`host' or `plugin').");
if ((may_be_empty == 0) && (buffer[0] == 0)) {
WARNING("Target `replace': Replacement resulted in an empty string, "
"which is not allowed for this buffer (`host' or `plugin').");
}
DEBUG("target_replace plugin: tr_action_invoke: -> buffer = %s;", buffer);
sstrncpy(buffer_in, buffer, buffer_in_size);
}
DEBUG("target_replace plugin: tr_action_invoke: -> buffer = %s;", buffer);
sstrncpy(buffer_in, buffer, buffer_in_size);
for (tr_meta_data_action_t *act = act_head; act != NULL; act = act->next) {
char temp[DATA_MAX_NAME_LEN];
for (tr_meta_data_action_t *act = act_head; act != NULL; act = act->next) {
char temp[DATA_MAX_NAME_LEN];
if (meta_data_status != 0) {
ERROR("Target `replace': Unable to retrieve metadata value for `%s'.",
act->key);
if (meta_data_status != 0) {
ERROR("Target `replace': Unable to retrieve metadata value for `%s'.",
act->key);
if ((result = meta_data_create()) == NULL) {
ERROR("Target `replace': failed to create metadata for `%s'.", act->key);
sfree(value);
if ((result = meta_data_create()) == NULL) {
ERROR("Target `replace': failed to create metadata for `%s'.", act->key);
sfree(value);
} /* }}} int tr_destroy */
static int tr_create(const oconfig_item_t *ci, void **user_data) /* {{{ */
} /* }}} int tr_destroy */
static int tr_create(const oconfig_item_t *ci, void **user_data) /* {{{ */
data = calloc(1, sizeof(*data));
if (data == NULL) {
ERROR("tr_create: calloc failed.");
data = calloc(1, sizeof(*data));
if (data == NULL) {
ERROR("tr_create: calloc failed.");
} /* }}} int tr_create */
static int tr_invoke(const data_set_t *ds, value_list_t *vl, /* {{{ */
} /* }}} int tr_create */
static int tr_invoke(const data_set_t *ds, value_list_t *vl, /* {{{ */
/* HANDLE_FIELD (type, 0); */
HANDLE_FIELD(type_instance, 1);
/* HANDLE_FIELD (type, 0); */
HANDLE_FIELD(type_instance, 1);