Skip to content

Commit b3ee873

Browse files
author
Robert Fekete
committed
Adds filterx dict_to_pairs
1 parent 659ed19 commit b3ee873

File tree

3 files changed

+29
-2
lines changed

3 files changed

+29
-2
lines changed

content/filterx/_index.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -411,7 +411,8 @@ For details, see {{% xref "/filterx/operator-reference.md" %}}.
411411
FilterX has the following built-in functions.
412412
413413
- [`cache_json_file`]({{< relref "/filterx/function-reference.md#cache-json-file" >}}): Loads an external JSON file to lookup contextual information.
414-
- [`dedup_metrics_labels`]({{< relref "/filterx/filterx-metrics/_index.md#metrics-labels" >}}): Deduplicate `metrics_labels` objects.
414+
- [`dedup_metrics_labels`]({{< relref "/filterx/filterx-metrics/_index.md#dedup-metrics-labels" >}}): Deduplicate `metrics_labels` objects.
415+
- [`dict_to_pairs`]({{< relref "/filterx/function-reference.md#dict-to-pairs" >}}): Convert dicts to list of pairs.
415416
- [`dpath`]({{< relref "/filterx/function-reference.md#dpath" >}}): Creates a nested path in a dictionary.
416417
- [`endswith`]({{< relref "/filterx/filterx-string-search/_index.md" >}}): Checks if a string ends with the specified value.
417418
- [`flatten`]({{< relref "/filterx/function-reference.md#flatten" >}}): Flattens the nested elements of an object.

content/filterx/function-reference.md

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,10 +63,32 @@ Usually, you use the [strptime](#strptime) FilterX function to create datetime v
6363
- When casting from a double, the double is the number of seconds elapsed since the UNIX epoch (00:00:00 UTC on 1 January 1970). (The part before the floating points is the seconds, the part after the floating point is the microseconds.)
6464
- When casting from a string, the string (for example, `1701350398.123000+01:00`) is interpreted as: `<the number of seconds elapsed since the UNIX epoch>.<microseconds>+<timezone relative to UTC (GMT +00:00)>`
6565

66-
## dedup_metrics_labels
66+
## dedup_metrics_labels {#dedup-metrics-labels}
6767

6868
Deduplicate `metrics_labels` objects. For details, see {{% xref "/filterx/filterx-metrics/_index.md#metrics-labels" %}}.
6969

70+
## dict_to_pairs {#dict-to-pairs}
71+
72+
Convert dicts to list of pairs.
73+
74+
Usage: `dict_to_pairs(<input-dict>, <key-name>, <value-name>)`
75+
76+
```shell
77+
my_dict = {
78+
"key_1": "value_1",
79+
"key_2": "value_2",
80+
"key_3": ["value_3", "value_4"],
81+
};
82+
83+
my_list = dict_to_pairs(my_dict, "key", "value");
84+
# The value of my_list will be:
85+
# [
86+
# {"key":"key_1","value":"value_1"},
87+
# {"key":"key_2","value":"value_2"},
88+
# {"key":"key_3","value":["value_3","value_4"]}
89+
# ]
90+
```
91+
7092
## dpath
7193

7294
Available in {{< product >}} 4.17 and later.

content/whats-new/_index.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@ weight: 10
66

77
{{< include-headless "banner-new-to-axosyslog.md" >}}
88

9+
## Version 4.19 (2025-10-15)
10+
11+
- The [`dict_to_pairs`]({{< relref "/filterx/function-reference.md#dict-to-pairs" >}}) FilterX function can convert a dictionary to a list of pairs.
12+
913
## Version 4.18 (2025-09-30)
1014

1115
- You can now use macros and templates in the [`headers()` option]({{< relref "/chapter-destinations/configuring-destinations-http-nonjava/reference-destination-http-nonjava/_index.md#headers" >}}) of the `http()` destination to set the headers dynamically.

0 commit comments

Comments
 (0)