user1401472
user1401472

Reputation: 2301

Run logstash on demand

Is it possible to run logstash on demand instead of streaming files? I have set of files placed in a folder, but I would like push only few of them on need basis to elasticsearch.

Is this even possible with logstash? I do have an option to do it programatically without using logstash. But considering the file size today (~10gb) and anticipated growth in future, I would like to see if logstash is an option here.

Upvotes: 1

Views: 967

Answers (2)

Val
Val

Reputation: 217514

You can always pipe the content of the file into Logstash using the stdin input:

cat myfile.txt | bin/logstash -f logstash.conf

where logstash.conf defines

input { 
    stdin{}
}

Upvotes: 2

studyz
studyz

Reputation: 34

You can refer to logstash-input-file for help. To sepcify the files you want to monitor:

input{
    file{
        path => ["/var/log/messages","/var/log/nginx/access.log"]
    }
}

or,in you case ,you can also monitor a folder and exclude some file in it:

input{
    file{
        path => ["/var/log/nginx/*.log"]
        exclude => "error.log"
    }
}

Upvotes: -1

Related Questions