]> git.ipfire.org Git - thirdparty/collectd.git/commitdiff
match_regex: Accept all data types of meta data 3231/head
authorTakuro Ashie <ashie@clear-code.com>
Fri, 26 Jul 2019 02:19:11 +0000 (11:19 +0900)
committerTakuro Ashie <ashie@clear-code.com>
Fri, 26 Jul 2019 03:18:54 +0000 (12:18 +0900)
match_regex currently accepts only string type of meta data, but
there is no reason to reject other data types since they can be
easily stringified by meta_data_as_string().
Accepting all data type will provide more benefit, for example
the following config can distinguish that data is local or remote,
the previous match_regex outputs many error logs for this config
though:

  <Match "regex">
    MetaData "network:received" "true"
  </Match>

Signed-off-by: Takuro Ashie <ashie@clear-code.com>
src/match_regex.c

index 99f0709bdfa8c494213e5a928c481c23f126f403..591d426071d83407fbfd25d4f273b46f5dc28276 100644 (file)
@@ -342,7 +342,7 @@ static int mr_match(const data_set_t __attribute__((unused)) * ds, /* {{{ */
     int status;
     if (vl->meta == NULL)
       return nomatch_value;
-    status = meta_data_get_string(vl->meta, e->key, &value);
+    status = meta_data_as_string(vl->meta, e->key, &value);
     if (status == (-ENOENT)) /* key is not present */
       return nomatch_value;
     if (status != 0) /* some other problem */