long()

Converts a string to a 64-bit integer.

Syntax

long(EXPR)
Required Parameter
EXPR
Expression that returns a string to be converted to a 64-bit integer. The argument must be one of a string, int, or IP address.

Description

When evaluating an expression, it works as follows:

  • When it is null, the function returns null.
  • Even when it cannot be converted to a 64-bit integer, the function also returns null.
  • If any other type is passed as an argument, the function automatically converts it into a string and then converts it to a 64-bit integer.

Usage

json "{}" | eval numbers=long("1234") => 1234

json "{}" | eval numbers=long(1234) => 1234

json "{}" | eval numbers=long(ip("0.0.0.1")) => 1

json "{}" | eval numbers=long(ip("192.168.0.1")) => 3232235521

json "{}" | eval numbers=long(null) => null

json "{}" | eval numbers=long("invalid") => null