Skip to content

len

The len() function returns the length of the provided argument.

Syntax

len(value)

Parameters

  • value: The value to measure the length of. This can be a field name, bytes, an array, or a map.

Return Value

Returns an integer representing the length of the provided value.

Example

len(http.request.uri.path) > 1024
len(http.request.headers["User-Agent"][0]) < 10

Use Cases

  • Checking the length of request URIs to prevent overly long URLs.
  • Validating input lengths in request parameters.
  • Identifying suspicious requests based on header length.