Why logstash service not work correctly but it is running in the foreground

Those are not errors, they have the log level of INFO.

It is just a check to see if the index you configured in your output can be a data stream or not.