# Postgresql log not sending data with logstash service

**URL:** https://discuss.elastic.co/t/postgresql-log-not-sending-data-with-logstash-service/36550
**Category:** Logstash
**Created:** [December 7, 2015, 3:35pm UTC](https://discuss.elastic.co/t/postgresql-log-not-sending-data-with-logstash-service/36550 "2015-12-07T15:35:56Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![yairaba](https://avatars.discourse-cdn.com/v4/letter/y/a8b319/32.png) [@yairaba](https://discuss.elastic.co/u/yairaba)
#### Post date: [December 7, 2015, 3:35pm UTC](https://discuss.elastic.co/t/postgresql-log-not-sending-data-with-logstash-service/36550/1 "2015-12-07T15:35:56Z")

</div>

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](http://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

---

<div class="post-metadata">

### Author: ![magnusbaeck](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/magnusbaeck/32/44943_2.png) [@magnusbaeck](https://discuss.elastic.co/u/magnusbaeck)
#### Post date: [December 7, 2015, 6:42pm UTC](https://discuss.elastic.co/t/postgresql-log-not-sending-data-with-logstash-service/36550/2 "2015-12-07T18:42:48Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)
#### Post date: [July 6, 2017, 5:19am UTC](https://discuss.elastic.co/t/postgresql-log-not-sending-data-with-logstash-service/36550/3 "2017-07-06T05:19:39Z")

</div>


