Help Center/ Log Tank Service/ Best Practices/ Log Jobs (Beta)/ Processing Log Data Using DSL Functions/ Scenario 2: Assigning Values to Empty Log Fields Using the e_set Function
Updated on 2025-12-04 GMT+08:00

Scenario 2: Assigning Values to Empty Log Fields Using the e_set Function

You can use the e_set function to assign values to empty fields in logs.

  1. Sub-scenario 1: assigns a value to a field when the field does not exist or its current value is empty.
    e_set("result", "......value......", mode="fill")

    Example:

    • Raw log
      {
          "name":""
      }
    • Processing rule
      e_set("name", "Apache 2.0", mode="fill")
    • Processing result
      {
      name:Apache 2.0
      }
  2. Sub-scenario 2: assigns values to multiple fields.
    e_set("k1", "v1", "k2", "v2")

    Example:

    • Raw log
      {"source":"192.168.0.1",
      "topic":"",
      "tag":"",
      "id":7990,
      "content":"this is a log"
      }
    • Processing rule
      e_set("topic","app","tag","stu")
    • Processing result
      {topic: app
      source: 192.168.0.1
      tag: stu
      id: 7990
      content: this is a log
      }