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

     1  ### `window_hit()` {fn-window-hit}
     2  
     3  Function prototype: `fn window_hit()`
     4  
     5  Function description: Trigger the recovery event of the context discarded data, and recover from the data recorded by the `point_window` function。
     6  
     7  Function parameters: None
     8  
     9  Example:
    10  
    11  ```python
    12  # It is recommended to place it in the first line of the script
    13  #
    14  point_window(8, 8)
    15  
    16  # If it is a panic log, keep the first 8 entries 
    17  # and the last 8 entries (including the current one)
    18  #
    19  if grok(_, "abc.go:25 panic: xxxxxx") {
    20      # This function will only take effect if point_window() is executed during this run.
    21      # Trigger data recovery behavior within the window
    22      #
    23      window_hit()
    24  }
    25  
    26  # By default, all logs whose service is test_app are discarded;
    27  # If it contains panic logs, keep the 15 adjacent ones and the current one.
    28  #
    29  if service == "test_app" {
    30      drop()
    31  }
    32  ```