Predefined EQL Functions
A list of functions that are available in the EQL.
Function Name | Arguments | Returns |
---|---|---|
ToTimestamp | The expression, which should evaluate to a string, is interpreted as a time according to the supplied formatString. If the conversion fails, null is returned, unless a default string is provided, which is interpreted as a time and returned.
Example:
ToTimestamp( logFileStringTimestampField, "dd, MM, yyyy HH:mm:ss", "America/ Los_Angeles", "01, 01, 1970 00:00:00")
If formatString does not contain a year, then when the function is being evaluated in the context of processing an event, the year from the event time (sys_eventTime) is used. If this results in a timestamp that is later than the event time, the prior year is used. |
|
ToIP | Convert the expression to an IP address (Java InetAddress). If the conversion fails, null is returned, unless a default string is provided, which is interpreted as an IP address and returned.
Example: ToIP(ipAddressField, "10.0.0.1") |
|
ToTimestampString | Same as ToTimestamp, except it gets converted to string to get a printable timestamp.
Example: ToTimestampString(timestamp , "dd, MM, yyyy HH:mm:ss", "America/Los_Angeles", "01, 01, 1970 00:00:00") Note: If timezone is omitted or is empty, the system default timezone is used. |
|
ToInt | The obvious conversion to integer with default value taken if not convertible.
Example: ToInt("1348") or ToInt(numberField, 0) |
|
ToLong | The obvious conversion to Long with default value taken if not convertible.
Example: ToLong("1348") or ToLong(numberField, 0) |
|
ToString | The obvious conversion to string with default value taken if not convertible.
Example: ToString(124.5) or ToString(numberField, "null") |
|
ToFloat | The obvious conversion to Float with default value taken if not convertible.
Example: ToFloat("1348.2") or ToLong(numberField, 0.0) Note: LogLogic LMI uses double precision (that is 64 bits) when storing floating point numbers. |
|
ToBool | The obvious conversion to Boolean with default value taken if not convertible.
Example: ToBool("FALSE") or ToBool(col1, FALSE) |
|
ExtractJson | The expression, which is a JSON string is parsed. A field is extracted from the expression using the extraction path. If either the expression or the path are invalid, an optional default value is returned.
Example: ExtractJson("{"cat": {"color":" blue"}}", "cat.color", "burlesque") returns a string "blue" which is a JSON value of color, which is a JSON value of cat. |
|
ExtractKvp |
|
The expression, which is a nested KVP string is parsed. A field is extracted from the expression using the extraction path. If either the expression or the path are invalid, an optional default value is returned.
Example: ExtractKvp(" alert={ agent={ hostname=esbqa01, dns=none}}" , "alert.agent.dns") returns a string "none". or ExtractKvp("(abc^def|asd^aaa)" , "asd", "()", "|", "^") returns "aaa". |
Function Name | Arguments | Returns |
---|---|---|
NaturalEqualTo | (arg1, arg2) | |
NaturalNotEqualTo | (arg1, arg2) |
Function Name | Arguments | Returns |
---|---|---|
IIF | Condition, then, else | Returns the value of the 'then' clause if the condition is true, otherwise the value of the 'else' clause.
Example: IIF(true, “a”, “b”) returns “a” if true and “b” if false |
Time functions
The following time functions are available:- seconds (timestamp, [multiplier])
- minutes (timestamp, [multiplier])
- hours (timestamp, [multiplier])
- days (timestamp, [multiplier])
- weeks (timestamp, [multiplier])
- months (timestamp, [multiplier])
- years (timestamp, [multiplier])
Each function returns the value of the specified timestamp parameter truncated to the corresponding time unit (seconds, minutes, hours, and so on).
If the optional parameter multiplier is specified, then the function creates a time bucket of the specified units and with the precision of the multiplier, and returns the truncated timestamp at the start of the time interval specified by multiplier.
This function creates a time bucket of 10 seconds, and returns the truncated timestamp out of the specified sys_eventTime at the start of the 10-second interval. That is, if the value of sys_eventTime is "2020-06-26 10:57:24", then it truncates the value to "2020-06-26 10:57:20".
Function Name | Arguments | Returns |
---|---|---|
geoiplookup
By using this function within SQL and EQL queries, you can search logs that originated from a particular geographical area such as location, country, city, postal code, and so on. You can use the function in Advanced Search and Advanced Dashboards. |
In the IPaddress parameter, you can specify an IP address or a column that stores an IP address such as Inet_Address. |
Returns the geographical information of a specified IPv4 or IPv6 address. Returns the country name if the field_option parameter is not specified. |
matchcidr
You can use the function within SQL, EQL, and ECL queries, and in turn, in other functionality that make use of these queries. |
In the IP_string_format parameter, you can specify a CIDR address, single IPv4 or IPv6 address, a comma-separated list of CIDR IP addresses or a range, a hyphen-separated range of IP addresses, or an enrichment list. In the IP_address_to_Match parameter, specify the column name from the logs, which are to be matched against the IP_string_format parameter. The data type of the column must be INET_ADDR. The key parameter specifies a key name in the enrichment list. The key parameter is mandatory when using this function in correlation bloks. You must provide a either key name or an empty string (""). |
Returns those IP addresses from the IP_address_to_Match parameter, which belong to the IP addresses specified in the IP_string_format list. |