Multiline codec plugin with no output



I'm trying to use Multiline codec plugin with Logstash

config file:

input {
    file {
            path => "/path/to/file"
            start_position => "beginning"
            sincedb_path => "/dev/null"
            codec => multiline {
                            pattern => "^%{YEAR:year}"
                            negate => true
                            what => "previous"
output {
    elasticsearch {
            index => "multiline"
            hosts => ["localhost:9200"]

after running the config file through the pipeline.yml it shows that pipelines are running and no errors are shown. However no results are found for the particular index in kibana.
But when starting logstash with this particular config manually:

bin/logstash –f test.config

then everything works as expected.

Can someone please help?