Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
software:postgresql:pg12 [2020/12/13 21:50] christiansoftware:postgresql:pg12 [2022/03/19 15:25] (current) christian
Line 1: Line 1:
 ====== PostgreSQL & PostGIS ====== ====== PostgreSQL & PostGIS ======
  
-Installing/upgrading to [[https://www.postgresql.org|PostgreSQL]] version 12.x and [[http://postgis.net|PostGIS]] version 3.0.1 on MacOS > High Sierra (10.14.x and higher).+Installing/upgrading to [[https://www.postgresql.org|PostgreSQL]] version 12.x and [[http://postgis.net|PostGIS]] version 3.0.1 on MacOS > High Sierra (10.13.x and higher).
  
 <note important>This note is in draft stage and currently just a dump of snippets</note> <note important>This note is in draft stage and currently just a dump of snippets</note>
Line 31: Line 31:
 After an upgrade of the OS it seems that the LaunchDaemon is broken. After an upgrade of the OS it seems that the LaunchDaemon is broken.
  
-==== Setting up the LaunchDaemon ====+The issues I encounter are related to file permissions for the log file. In this case the user ''_postgresql'' does not have permissions to write to ''/var/log/Postgresql.log'' as only ''root'' as access here. This has likely changed between earlier Mac OS versions and Catalina (which is where the issue popped up). 
  
-On their [[http://opensource.apple.com|OpenSource pages]] Apple provides template for one of the [[https://opensource.apple.com/source/PostgreSQL/PostgreSQL-23/|older included PostgreSQL versions (here9.0.4)]]. This deviates bit from what I used previously for the LaunchDaemon file.+So there seems to be two options going forward: 
 + 
 +  - have ''pgsql'' directly log to the ''syslog'' 
 +  - use conventional ''stdout'' and ''stderr'' as log output directions, but change the logfile location  and permissions. 
 + 
 +On first sight is look as if option 1 is more elegant, but there is very little information as to how this should be set up and I have very little experience with ''syslog''
 + 
 +Here's a few links to get started: 
 + 
 +  * ''man asl.conf'' - manpage for Apple's system log tool 
 +  * [[https://nozaki.me/roller/kyle/entry/articles-postgres-log|Kohei Nozaki's blog entry]] on Postgresql using ''syslog'' 
 +  * [[https://superuser.com/questions/278231/how-to-disable-set-logging-level-preferences-per-mac-os-x-application| SO: log level prefs per OS X application]] 
 +  * [[https://superuser.com/questions/932013/asl-conf-doesnt-take-an-effect-on-my-enviroment-os-x-yosemite]] 
 +  * [[https://apple.stackexchange.com/questions/6559/setting-a-custom-log]] 
 +  * [[https://www.loggly.com/ultimate-guide/linux-logging-basics/|Linux logging basics]] 
 +  * [[https://apple.stackexchange.com/questions/338213/how-to-run-a-launchagent-that-runs-a-script-which-causes-failures-because-of-sys]] 
 +  * [[https://apple.stackexchange.com/questions/387592/how-to-use-launchd]] 
 +  * [[https://www.linuxwave.info/2018/12/send-postgresql-log-to-syslog.html|Getting postgresql write to syslog]] 
 +  * [[https://apple.stackexchange.com/questions/195997/running-postgres-as-launch-daemon]] 
 +  * [[https://developer.apple.com/documentation/os/logging]] 
 +  * [[https://apple.stackexchange.com/questions/357179/unified-logs-macos-high-sierra?rq=1]] 
 +  * [[https://apple.stackexchange.com/questions/162487/how-can-one-start-a-process-and-monitor-its-syslog-messages?rq=1]] 
 +  * [[https://apple.stackexchange.com/questions/390986/can-i-have-launchctl-output-stdout-stderr-from-my-application-to-the-system-wide?rq=1]] 
 +  * [[https://ilostmynotes.blogspot.com/2011/11/os-x-logging-aslconf-syslogconf-and.html]] 
 +  * [[https://www.unixtutorial.org/syslog-and-asl-in-macos/]] 
 +  * [[https://www.launchd.info]] 
 +  * [[https://superuser.com/questions/943983/os-x-launchdaemon-not-running-service-could-not-initialize]] 
 +  * [[https://stackoverflow.com/questions/27700596/homebrew-postgres-broken]] 
 +  * [https://apple.stackexchange.com/questions/322078/what-are-all-the-available-acl-attributes-in-mac-os-10-13-high-sierra]] 
 +  * [[https://unix.stackexchange.com/questions/479890/permission-to-write-to-log]] 
 +  * [[https://stackoverflow.com/questions/32160108/os-x-launchd-script-fails-to-run-at-startup?rq=1]] 
 +  *  
 + 
 + 
 + 
 + 
 +==== Setting up the LaunchDaemon ====
  
-[[https://developer.apple.com/library/archive/documentation/MacOSX/Conceptual/BPSystemStartup/Chapters/CreatingLaunchdJobs.html|+On their [[http://opensource.apple.com|OpenSource pages]] Apple provides a template for one of the  [[https://opensource.apple.com/source/PostgreSQL/PostgreSQL-23/|older included PostgreSQL versions (here: 9.0.4)]]. This deviates a bit from what I used previously for the LaunchDaemon file.
  
-Verbatim copy of [[https://opensource.apple.com/source/PostgreSQL/PostgreSQL-23/org.postgresql.postgres.plist.auto.html|of Apple's org.postgresql.postgres.plist on their opensource site]] :+[[https://developer.apple.com/library/archive/documentation/MacOSX/Conceptual/BPSystemStartup/Chapters/CreatingLaunchdJobs.html| Verbatim copy of [[https://opensource.apple.com/source/PostgreSQL/PostgreSQL-23/org.postgresql.postgres.plist.auto.html|of Apple's org.postgresql.postgres.plist on their opensource site]]:
  
 <file org.postgresql.postgres.plist> <file org.postgresql.postgres.plist>