Logstash can't read files ( Permission denied )

Hi All,

I have problem about Logstash,.
Log from logstash.log

{:timestamp=>"2016-06-23T09:17:41.150000+0700", :message=>"failed to open /var/log/messages: Permission denied - /var/log/messages", :level=>:warn}
{:timestamp=>"2016-06-23T09:17:48.033000+0700", :message=>"failed to open /var/log/messages: Permission denied - /var/log/messages", :level=>:warn}
{:timestamp=>"2016-06-23T09:22:42.483000+0700", :message=>"failed to open /var/log/messages: Permission denied - /var/log/messages", :level=>:warn}
{:timestamp=>"2016-06-23T09:22:49.027000+0700", :message=>"failed to open /var/log/messages: Permission denied - /var/log/messages", :level=>:warn}
{:timestamp=>"2016-06-23T09:27:43.793000+0700", :message=>"failed to open /var/log/messages: Permission denied - /var/log/messages", :level=>:warn}
{:timestamp=>"2016-06-23T09:27:50.400000+0700", :message=>"failed to open /var/log/messages: Permission denied - /var/log/messages", :level=>:warn}
{:timestamp=>"2016-06-23T09:32:44.419000+0700", :message=>"failed to open /var/log/messages: Permission denied - /var/log/messages", :level=>:warn}

i follow this link :


but can not solve my problem.what should i do to fix it?

thank you in advance

your error Permission denied is telling you exactly what is wrong.

post everything that you tried.

Hi,

I add this configuration at /etc/logstash/conf.d/logstash.conf

input {
file {
path => "/var/log/messages"
type => "syslog"
}

file {
path => "/var/log/nginx/*.log"
type => "nginx"
}
}

output {
elasticsearch {
hosts => localhost
}
stdout { codec => json }

thank you

right, but what permissions did you give to those files?
who is the owner/group?

Hi,

it is
-rw-r--r--. 1 nginx root 596118 Jun 26 06:25 /var/log/nginx/access.log
-rw-r--r--. 1 nginx root 21464 Jun 26 06:24 /var/log/nginx/error.log
[root@sysadmin cloud-user]# ll /var/log/messages
-rw-------. 1 root root 92153 Jun 27 04:18 /var/log/messages

thanks

you must give permission to user or group logstash to access the log file.

that's all.