Add new document using logstash

i have a file so i read this file using filebeat and i do the multilne like this

- type: log
  enabled: true
    - D:\elastic_stack\logs\*
        kafka_topic: "kafka-topic-1"
  tags: ["ok"]
  multiline.type: pattern
  multiline.pattern: '^\s*\*TR\sSTART\*\s*'
  multiline.negate: true
  multiline.match: after
  multiline.max_lines: 1000

here my example of one log :

     *TR START*                
 AAAA IN                          
AAAA: ******12                  
DATE 20-07-22    TIME 07:37:48          
 07:37:56 PI                   
 07:38:00 A            
 07:38:02 OP             
 07:38:03 GE                
 07:38:04 GE                
DATE       HEURE    A                 
20/07/22   07:37    0000002         
TR. NO:     3984                     
 07:38:24 A             
 07:38:26 OP            
 07:38:27 GE               
 07:38:28 GE               
DATE       HEURE    A                 
20/07/22   07:37    12121212          
AAAA: ******12                   
MO  :       20         
TRANS. NO:     3985                     
  TR REF                   
R€o : 60                          
 07:38:32 AAAA T                  
 07:38:35 TR END               

each log must have a TR. NO: ...what I want if I find two TR. NO in the message, add a new document if possible or I did it because I found another TR. NO after this one I have an empty line so I did this

if([message] =~ /^TR\.\sNO:.*[\r\n]*^\s{40}/) {
      #if i found this one add me a new document 

Any help would be sincerely appreciate!

I mean if I found two TR. NO: In a document (in message) add me a new document that contains the second TR. NO so in my example I have TR. NO: 3984 And another TR. NO: 3985 so I want to add a new document if it's possible, I hope you understand me

can't logstash add a new document ??

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.