Postgresql log not sending data with logstash service


#1

Hi
postgresql logs are not processed when logstash run as service ,

When i run it with below command line it works
/opt/logstash/bin/logstash agent -f /etc/logstash/conf.d
See below conf file and logstash debug message

input definitions

input {
file {
type => "postgresql"
path => "/var/lib/postgresql/9.3/main/pg_log/postgresql-*.log"
add_field => { "service" => "postgresql" }
codec => multiline {
pattern => "%{YEAR}-%{MONTHNUM2}-%{MONTHDAY}%{GREEDYDATA}"
negate => true
what => "previous"
}
start_position => beginning
}
}

filter definitions

filter {
if [type] == "postgresql" {
grok {
patterns_dir => ["/etc/logstash/patterns"]
match => {
"message" => "%{TKD_POSTGRESQL}"
}
}
}
}

output definitions

output {
gelf {
host => 'myserver.domain.com'
port => "12201"
}
}

{:timestamp=>"2015-12-07T13:24:58.937000+0000", :message=>"_discover_file_glob: /var/lib/postgresql/9.3/main/pg_log/postgresql-*.log: glob is: []", :level=>:debug, :file=>"filewatch/watch.rb", :line=>"132", :method=>"_discover_file"}

Thanks
Yair


(Magnus B├Ąck) #2

This is the key clue:

_discover_file_glob: /var/lib/postgresql/9.3/main/pg_log/postgresql-*.log: glob is: []"

The filename pattern expands to zero files. Either there's a typo in the path or the Logstash user doesn't have permission to read one of the directories leading up to the log files.


(system) #3