Skip to content

eval

eval

Create or modify fields by evaluating expressions for each record.

| eval newField = expression
| eval duration_sec = duration / 1000
  • newField = expression: Assigns the result of the expression to a new or existing field.

You can use arithmetic, logical, and conditional expressions, as well as functions, in eval assignments. Common supported functions include:

Only functions supported by your Cruncher deployment are available. See the main documentation for a full list.

  • Use eval to compute new values, transform fields, or perform calculations.
  • You can assign multiple fields by chaining multiple eval commands in your pipeline.
  • Use conditional logic to create new fields based on complex criteria.
| eval duration_sec = duration / 1000

This creates a duration_sec field by dividing duration by 1000.

| eval is_error = (status == "error")

This creates a boolean field is_error that is true when status equals "error".

| eval user_lower = lower(user)

This creates a new field user_lower with the lowercase value of user.

| eval error_type = if(status == "error", "critical", "normal")

This creates a new field error_type based on the value of status.

| eval match_found = match(message, `^Error:.*`)

This creates a boolean field match_found that is true when message matches the regex.

| eval group = case(status == "error", "A", status == "warn", "B", "C")

This creates a field group with value "A" for errors, "B" for warnings, and "C" otherwise.

  • where — filter records by boolean condition
  • regex — extract fields using regex patterns