/var/log/pg.log is a link
lrwxrwxrwx 1 root root 20 May 7 13:01 /var/log/pg.log -> /errlog/pg.log
The source file is:
-rw-r--r-- 1 postgres iii 1020 May 8 07:36 /errlog/pg.log
I tried linking thinking it was something funny about reading from outside of /var/log when run as a service.
I also tried commenting out the multiline codec on the input and restarted the service but I still get nothing processed when adding new lines to pg.log.
The output file is:
-rw-rw-r-- 1 logstash logstash 0 May 8 03:14 /errlog/postgresql-current.log
and is useable as the logstash user sudo -u logstash /bin/bash
To be sure I added logstash to the group that owns the path to errlog in /etc/group as a secondary group
Is new data being added to the file? Because Logstash is tailing it. If you want to read the file from the beginning you need to change the start_position parameter (and nuke the sincedb data to reset the current position).
New data is being added after starting the service. To generate new items I just issue a postgres login with a made up user name so I know it will fail.
These were all added to the pg.log file post restart:
2018-05-08 12:35:03 PDT [1666]: [1-1] user=test,db=iii,appname=[unknown] FATAL: pg_hba.conf rejects connection for host "[local]", user "test", database "iii", SSL off
2018-05-08 12:35:04 PDT [1693]: [1-1] user=test,db=iii,appname=[unknown] FATAL: pg_hba.conf rejects connection for host "[local]", user "test", database "iii", SSL off
2018-05-08 12:35:05 PDT [1719]: [1-1] user=test,db=iii,appname=[unknown] FATAL: pg_hba.conf rejects connection for host "[local]", user "test", database "iii", SSL off
2018-05-08 12:36:29 PDT [1776]: [1-1] user=test,db=iii,appname=[unknown] FATAL: pg_hba.conf rejects connection for host "[local]", user "test", database "iii", SSL off
sh-4.1$ /usr/share/logstash/bin/logstash --path.settings /etc/logstash
Sending Logstash's logs to /var/log/logstash which is now configured via log4j2.properties
in a second window I create some failures with postgres login and output comes slack messages and log file outout:
I have the same results even using different centos 6 machines, so I'm sure it is something basic, I just don't have enough info to know what that might be.
Each case the install was done using the installer from docs (add key, create repo file, yum install)
We did find a solution that I wanted to include here should someone else find it useful.
The problem ended up being our custom applications that we wanted to parse logs from where unreadable to logstash, even after adding the logstash OS user to the additional groups that would have owned the files. That was checked by sudo'ing to the logstash user and confirming access to input and output files.
Apparently the upstart use of chroot strips of the secondary group permissions giving the situation I had where the logstash user could run logstash from CLI, but not as a service. Saddly the /var/log/logstash output never said it couldn't open files in what I think was falling into a case of waiting for the file to appear.
Our solution was to edit the /etc/init/logstash.conf file to add --groups=g1,g2. With that change a stop and start of the upstart service solved the problem and we started getting our output from there on.
Thanks to Magnus for offering his suggestions and time trying to help out.
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.