I have made some adjustments to my output file.
I have an input of TCP/1514 and output that currently goes to ES. When I have LS running I can Telnet to log01 on 1514 and then write something which LS then feeds to ES which I can then search for it with no problems.
I adjusted my output to be bare -->
} else if [type] == "esxi-log01" {
file {
path => "/var/log/esxi.log"
And running foreground mode it works!! (Enabled --verbose, so I could see what's going on).
I used this command:
/opt/logstash/bin/logstash -f /etc/logstash/conf.d/ --verbose
Opening file {:path=>"/var/log/esxi.log", :level=>:info}
Starting stale files cleanup cycle {:files=>{"/var/log/esxi.log"=>#<IOWriter:0x36bb512e @active=true, @io=#<File:/var/log/esxi.log>>}, :level=>:info}
Starting stale files cleanup cycle {:files=>{"/var/log/esxi.log"=>#<IOWriter:0x36bb512e @active=true, @io=#<File:/var/log/esxi.log>>}, :level=>:info}
Starting stale files cleanup cycle {:files=>{"/var/log/esxi.log"=>#<IOWriter:0x36bb512e @active=true, @io=#<File:/var/log/esxi.log>>}, :level=>:info}
Starting stale files cleanup cycle {:files=>{"/var/log/esxi.log"=>#<IOWriter:0x36bb512e @active=true, @io=#<File:/var/log/esxi.log>>}, :level=>:info}
Starting stale files cleanup cycle {:files=>{"/var/log/esxi.log"=>#<IOWriter:0x36bb512e @active=true, @io=#<File:/var/log/esxi.log>>}, :level=>:info}
I can see stuff in /var/log/esxi.log.
I then did a test of running it with 'systemctl start logstash' to see whats going on...
nothing.
I then chmod 777 esxi.log and then telneted into port 1514 and I can see my output.
So I think I have a permission issue but for now my workaround is to touch the file beforehand and 'fixup' the permission then start LS.. will also adjust my logrotate so when a new file is created it has the right permission.
I have put the file output with elasticsearch as per following:
} else if [type] == "esxi-log01" {
file {
path => "/var/log/esxi.log"
}
elasticsearch {
hosts => ["els03","els04"]
sniffing => true
manage_template => false
index => "esxi-%{+YYYY.MM.dd}"
document_type => "esxi-log01"
}
performed a config test -
/opt/logstash/bin/logstash --configtest -f /etc/logstash/conf.d/
came back with configuration OK.
restart LS and now I can see my output in both the log file and in ES
Happy !