Run Logstash config file from a flask script

Hello,

I want to run a logstash config file in a flask script. I used subprocess function, i don’t get any error but it doesn’t work.
Could anyone help me please ??
PS : there is no output when I run the logstash config file, it’s just import the data into Elasticsearch.

import os
import subprocess

	# desired path
	target_dir = os.path.join("C:",os.sep,"elastic_stack",os.sep,"logstash-7.6.2")

	# small check
	if os.path.isdir(target_dir):
	  os.chdir(target_dir)
	else:
	  print(" pathname does not refer to an existing directory")

	# current working directory
	print(os.getcwd())

	# start logstash directly os.system will return the return code of the command if it's 0 means OK
	os.system(".\\bin\\logstash -f C:\\Users\\Asus\\Desktop\\flask_project_part2\\project\\logstash_file.conf")

	# if you need the output after you started logstash it will work ONLY in Python3

	process = subprocess.run([".\\bin\\logstash", "-f", "C:\\Users\\Asus\\Desktop\\flask_project_part2\\project\\logstash_file.conf"], stdout=subprocess.PIPE, stderr=subprocess.PIPE)


	output = process.stdout
	errors = process.stderr
				

this is the config file :

input{
	file{
	    path => "C:/Users/Asus/Dropbox/PFE_part2/MOOV_DOGBO_2G.CSV"      
      start_position => "beginning"
      sincedb_path => "NUL"
      codec => plain { charset => "CP1252" }
	}
}

filter{
	csv {
        separator => ";"
        
          
        convert => {
            "longitude" => "float"
            "latitude" => "float"
   
        } 
        
    }
    date { match => [ "time", "dd MMM yy HH:mm:ss" ] }

    mutate{ add_field => { "location" => "%{latitude},%{longitude}" } } 
}

output{
	elasticsearch { 
	    action => "index"
      hosts =>["http://localhost:9200/"]
      index => "nov_test_2"         
  }
  
}