How do I rotate the output log files of logstash

Hi I am trying to log all the logstash output including Errors /Info. What is the best recommended way? Also I want to rotate the log file. I see there is an output-> file command supported in config. but the option max_size is not yet supported. Also there is a --log command line arg. Can someone recommend a good way for logging all the messages logstash spits out. Also is there a performance consideration if logstash spits out all the outputs to log files? Many Thanks

Output to a file is very inefficient as it's a lot of IO.
Where else are you storing the data?

Are you talking about Logstash's own logs or messages processed by Logstash?

This is the logstash output (logs printed by logstash) both Error/Info and the messages it sends to output.

Answering Mark I am sending the data to Elastic and also want to log it somewhere what I have sent , are you saying instead of file plugin I should redirect stdout/error to a file or should try to avoid the whole thing ?

Answering Mark I am sending the data to Elastic and also want to log it somewhere what I have sent , are you saying instead of file plugin I should redirect stdout/error to a file or should try to avoid the whole thing ?

If you care about I/O load then you should avoid it. Not sure why you feel the need to store everything locally when you're already pushing it into Elasticsearch.

Logstash's Debian and RPM packages include a logrotate configuration file that causes /var/log/logstash/logstash.log to get rotated daily with a week's worth of logs kept around.

Thanks
i want to read logs form mongodb so how can i do that??

Please start your own thread.