github.com/GuanceCloud/cliutils@v1.1.21/pipeline/ptinput/funcs/md/group_in.en.md (about)

     1  ### `group_in()` {#fn-group-in}
     2  
     3  Function prototype: `fn group_in(key: int|float|bool|str, range: list, new_value: int|float|bool|str|map|list|nil, new-key = "")`
     4  
     5  Function description: If the `key` value is in the list `in`, a new field can be created and assigned the new value. If no new field is provided, the original field value will be overwritten
     6  
     7  Example:
     8  
     9  ```python
    10  # If the field log_level value is in the list, change its value to "OK"
    11  group_in(log_level, ["info", "debug"], "OK")
    12  
    13  # If the field http_status value is in the specified list, create a new status field with the value "not-ok"
    14  group_in(log_level, ["error", "panic"], "not-ok", status)
    15  ```