You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: content/filterx/_index.md
+7-7Lines changed: 7 additions & 7 deletions
Original file line number
Diff line number
Diff line change
@@ -85,7 +85,7 @@ filterx {
85
85
The same is true for complex objects, like JSON, for example:
86
86
87
87
```shell
88
-
js = json_object({
88
+
js = json({
89
89
"key": "value",
90
90
"second-key": "another-value"
91
91
});
@@ -145,7 +145,7 @@ Variables can have the following types. All of these types have a matching funct
145
145
-`dict`
146
146
-`double`
147
147
-`int`
148
-
-[`json, json_object`]({{< relref "/filterx/function-reference.md#json" >}}) and [`json_array`]({{< relref "/filterx/function-reference.md#json-array" >}}) for JSON or JSON-like objects. The `json` type is an alias for the `json_object` type.
148
+
-[`json`]({{< relref "/filterx/function-reference.md#json" >}}) and [`json_array`]({{< relref "/filterx/function-reference.md#json-array" >}}) for JSON or JSON-like objects.
149
149
-`list`
150
150
-`null`
151
151
-`otel_array`
@@ -254,7 +254,7 @@ my_list = []; # Creates an empty list (which defaults to a JSON list)
254
254
my_array = {};# Creates an empty dictionary (which defaults to a JSON object)
255
255
256
256
my_list2 = json_array(); # Creates an empty JSON list
257
-
my_array2 = json_object(); # Creates an empty JSON object. json() is an alias for json_object()
257
+
my_array2 = json(); # Creates an empty JSON object.
258
258
```
259
259
260
260
You can add elements to lists and dictionaries like this:
@@ -287,7 +287,7 @@ ${MESSAGE} = list;
287
287
288
288
In all three cases, the value of `${MESSAGE}` is the same JSON array: `["first_element", "second_element", "third_element"]`.
289
289
290
-
You can define JSON objects using the `json_object` type, for example:
290
+
You can define JSON objects using the `json()` type, for example:
291
291
292
292
```shell
293
293
js1 = json();
@@ -300,14 +300,14 @@ js1 += {
300
300
}
301
301
};
302
302
303
-
js2 = json_object({"key": "value"})
303
+
js2 = json({"key": "value"})
304
304
```
305
305
306
306
Naturally, you can assign values from other variables to an object, for example:
Copy file name to clipboardExpand all lines: content/filterx/function-reference.md
+22-22Lines changed: 22 additions & 22 deletions
Original file line number
Diff line number
Diff line change
@@ -17,7 +17,7 @@ Functions have arguments that can be either mandatory or optional.
17
17
18
18
## cache_json_file {#cache-json-file}
19
19
20
-
Load the contents of an external JSON file in an efficient manner. You can use this to lookup contextual information. (Basically, this is a FilterX-specific implementation of the [`add-contextual-data() functionality`]({{< relref "/chapter-enrich-data/data-enrichment-add-contextual-data/_index.md" >}}).)
20
+
Load the contents of an external JSON file in an efficient manner. You can use this function to lookup contextual information. (Basically, this is a FilterX-specific implementation of the [`add-contextual-data() functionality`]({{< relref "/chapter-enrich-data/data-enrichment-add-contextual-data/_index.md" >}}).)
21
21
22
22
Usage: `cache_json_file("/path/to/file.json")`
23
23
@@ -61,8 +61,8 @@ date = datetime("1701350398.123000+01:00");
61
61
62
62
Usually, you use the [strptime](#strptime) FilterX function to create datetime values. Alternatively, you can cast an integer, double, string, or isodate variable into datetime with the `datetime()` FilterX function. Note that:
63
63
64
-
- When casting from an integer, the integer is the number of microseconds elapsed since the UNIX epoch (January 1, 1970 12:00:00 AM).
65
-
- When casting from a double, the double is the number of seconds elapsed since the UNIX epoch (January 1, 1970 12:00:00 AM). (The part before the floating points is the seconds, the part after the floating point is the microseconds.)
64
+
- When casting from an integer, the integer is the number of microseconds elapsed since the UNIX epoch (00:00:00 UTC on 1 January 1970).
65
+
- 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.)
66
66
- 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)>`
67
67
68
68
## flatten
@@ -90,7 +90,7 @@ Only the input is mandatory, other arguments are optional. Note that the delimit
90
90
91
91
By default, the delimiter is the comma (`delimiter=","`), the `columns` and `default_value` are empty.
92
92
93
-
If the `columns` option is set, {{< product >}} checks that the number of entries in the input data matches the number of columns. If there are fewer entries, it adds the `default_value` to the missing entries.
93
+
If the `columns` option is set, {{< product >}} checks that the number of fields or entries in the input data matches the number of columns. If there are fewer items, it adds the `default_value` to the missing entries.
If the object doesn't exist, `istype()` returns with an error, causing the FilterX statement to become false, and logs an error message to the `internal()` source of {{< product >}}.
146
148
147
-
## json, json_object {#json}
149
+
## json {#json}
148
150
149
-
Cast a value into a JSON object.`json_object()` is an alias for `json()`.
151
+
Cast a value into a JSON object.
150
152
151
-
Usage: `json(<string or expression to cast as json>)`
153
+
Usage: `json(<string or expression to cast to json>)`
152
154
153
155
For example:
154
156
@@ -160,7 +162,7 @@ js = json({"key": "value"});
160
162
161
163
Cast a value into a JSON array.
162
164
163
-
Usage: `json_array(<string or expression to cast as json array>)`
165
+
Usage: `json_array(<string or expression to cast to json array>)`
164
166
165
167
For example:
166
168
@@ -176,7 +178,7 @@ Usage: `len(object)`
176
178
177
179
## lower
178
180
179
-
Converts a string into lowercase characters.
181
+
Converts all characters of a string lowercase characters.
If you use mixed (some named, some unnamed) groups, the output is a dictionary, where {{< product >}} automatically assigns a key to the unnamed groups. For example:
260
+
If you use mixed (some named, some unnamed) groups in your regular expression, the output is a dictionary, where {{< product >}} automatically assigns a key to the unnamed groups. For example:
259
261
260
262
```shell
261
263
${MY-LIST} = json(); # Creates an empty JSON object
For a case sensitive search, use the `ignorecase=true` option.
290
-
291
291
### Options
292
292
293
293
You can use the following flags with the `regexp_subst` function:
294
294
295
295
-`global=true`:
296
296
297
-
Replace every occurrence of the search string.
297
+
Replace every match of the regular expression, not only the first one.
298
298
299
299
-`ignorecase=true`:
300
300
301
-
Do case insensitive search.
301
+
Do case insensitive match.
302
302
303
303
-`jit=true`:
304
304
@@ -310,7 +310,7 @@ You can use the following flags with the `regexp_subst` function:
310
310
311
311
## string
312
312
313
-
Cast a value into a string. Note currently {{< product >}} evaluates strings and executes [template functions]({{< relref "/filterx/_index.md#template-functions" >}}) and template expressions. In the future, template evaluation will be moved to a separate FilterX function.
313
+
Cast a value into a string. Note that currently {{< product >}} evaluates strings and executes [template functions]({{< relref "/filterx/_index.md#template-functions" >}}) and template expressions within the strings. In the future, template evaluation will be moved to a separate FilterX function.
314
314
315
315
Usage: `string(<string or expression to cast>)`
316
316
@@ -340,11 +340,11 @@ If none of the format strings match, `strptime` returns the null value and logs
340
340
341
341
{{% /alert %}}
342
342
343
-
You can use the following elements in the format string:
343
+
You can use the following format codes in the format string:
Copy file name to clipboardExpand all lines: content/headless/chunk/date-string-format.md
+2-3Lines changed: 2 additions & 3 deletions
Original file line number
Diff line number
Diff line change
@@ -44,11 +44,10 @@
44
44
45
45
{{% alert title="Warning" color="warning" %}}
46
46
47
-
When using the %z and %Z format elements, consider that while %z strictly expects a specified timezone, and triggers a warning if the timezone is not specified, %Z does not trigger a warning if the timezone is not specified.
47
+
When using the `%z` and `%Z` format codes, consider that while `%z` strictly expects a specified timezone, and triggers a warning if the timezone is missing, `%Z` does not trigger a warning if the timezone is not specified.
48
48
49
-
For further information about the %z and %Z format elements, see the 'DESCRIPTION' section on the [srtptime(3) - NetBSD Manual Pages](https://man.netbsd.org/NetBSD-7.0/i386/strptime.3).
49
+
For further information about the `%z` and `%Z` format codes, see the 'DESCRIPTION' section on the [srtptime(3) - NetBSD Manual Pages](https://man.netbsd.org/NetBSD-7.0/i386/strptime.3).
50
50
51
51
{{% /alert %}}
52
52
53
-
54
53
For example, for the date `01/Jan/2016:13:05:05 PST` use the following format string: `"%d/%b/%Y:%H:%M:%S %Z"`
0 commit comments