Add patch to enable parameters related to logging_collector.
authorBo Peng <pengbo@sraoss.co.jp>
Tue, 22 Feb 2022 04:38:51 +0000 (13:38 +0900)
committerBo Peng <pengbo@sraoss.co.jp>
Tue, 22 Feb 2022 04:38:51 +0000 (13:38 +0900)
src/pgpool.spec
src/redhat/pgpool_log.patch [new file with mode: 0644]

index 2af1a2dc668052892e3500bda780744d3e20a177..e77472f0206eff0bce836852cfae7001f02eee3a 100644 (file)
@@ -21,6 +21,7 @@
 %endif
 
 %global _varrundir %{_localstatedir}/run/pgpool
+%global _varlogdir %{_localstatedir}/log/pgpool_log
 
 Summary:        Pgpool is a connection pooling/replication server for PostgreSQL
 Name:           pgpool-II-pg%{pg_version}
@@ -42,6 +43,7 @@ Patch1:         pgpool-II-head.patch
 Patch2:         pgpool_socket_dir.patch
 Patch3:         pcp_unix_domain_path.patch
 %endif
+Patch4:         pgpool_log.patch
 BuildRoot:      %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
 BuildRequires:  postgresql%{pg_version}-devel pam-devel openssl-devel libmemcached-devel jade libxslt docbook-dtds docbook-style-xsl docbook-style-dsssl openldap-devel
 %if %{pgsql_ver} >= 110 && %{rhel} == 7
@@ -99,6 +101,7 @@ PostgreSQL extensions libraries and sql files for pgpool-II.
 %patch2 -p0
 %patch3 -p0
 %endif
+%patch4 -p0
 
 %build
 %configure --with-pgsql=%{pghome} \
@@ -150,6 +153,8 @@ install -d %{buildroot}%{_initrddir}
 install -m 755 %{SOURCE1} %{buildroot}%{_initrddir}/pgpool
 %endif
 
+mkdir -p %{buildroot}%{_varlogdir} 
+
 install -d %{buildroot}%{_sysconfdir}/sysconfig
 %if 0%{rhel} && 0%{rhel} <= 6
     install -m 644 %{SOURCE2} %{buildroot}%{_sysconfdir}/sysconfig/pgpool
@@ -257,6 +262,7 @@ fi
 %else
 %{_initrddir}/pgpool
 %endif
+%attr(0755,postgres,postgres) %dir %{_varlogdir}
 %defattr(600,postgres,postgres,-)
 %{_sysconfdir}/%{short_name}/pgpool.conf.sample
 %{_sysconfdir}/%{short_name}/pcp.conf.sample
diff --git a/src/redhat/pgpool_log.patch b/src/redhat/pgpool_log.patch
new file mode 100644 (file)
index 0000000..aaab1e8
--- /dev/null
@@ -0,0 +1,98 @@
+*** src/sample/pgpool.conf.sample      2022-02-10 12:49:15.079700949 +0900
+--- pgpool.conf.sample 2022-02-22 11:05:17.073517397 +0900
+***************
+*** 186,192 ****
+  
+  # - Where to log -
+  
+! #log_destination = 'stderr'
+                                     # Where to log
+                                     # Valid values are combinations of stderr,
+                                     # and syslog. Default to stderr.
+--- 186,192 ----
+  
+  # - Where to log -
+  
+! log_destination = 'stderr'
+                                     # Where to log
+                                     # Valid values are combinations of stderr,
+                                     # and syslog. Default to stderr.
+***************
+*** 252,268 ****
+                                          #   panic
+  
+  # This is used when logging to stderr:
+! #logging_collector = off
+                                          # Enable capturing of stderr
+                                          # into log files.
+                                          # (change requires restart)
+  
+  # -- Only used if logging_collector is on ---
+  
+! #log_directory = '/tmp/pgpool_logs'
+                                          # directory where log files are written,
+                                          # can be absolute
+! #log_filename = 'pgpool-%Y-%m-%d_%H%M%S.log'
+                                          # log file name pattern,
+                                          # can include strftime() escapes
+  
+--- 252,268 ----
+                                          #   panic
+  
+  # This is used when logging to stderr:
+! logging_collector = on
+                                          # Enable capturing of stderr
+                                          # into log files.
+                                          # (change requires restart)
+  
+  # -- Only used if logging_collector is on ---
+  
+! log_directory = '/var/log/pgpool_log'
+                                          # directory where log files are written,
+                                          # can be absolute
+! log_filename = 'pgpool-%a.log'
+                                          # log file name pattern,
+                                          # can include strftime() escapes
+  
+***************
+*** 270,276 ****
+                                          # creation mode for log files,
+                                          # begin with 0 to use octal notation
+  
+! #log_truncate_on_rotation = off
+                                          # If on, an existing log file with the
+                                          # same name as the new log file will be
+                                          # truncated rather than appended to.
+--- 270,276 ----
+                                          # creation mode for log files,
+                                          # begin with 0 to use octal notation
+  
+! log_truncate_on_rotation = on
+                                          # If on, an existing log file with the
+                                          # same name as the new log file will be
+                                          # truncated rather than appended to.
+***************
+*** 280,290 ****
+                                          # off, meaning append to existing files
+                                          # in all cases.
+  
+! #log_rotation_age = 1d
+                                          # Automatic rotation of logfiles will
+                                          # happen after that (minutes)time.
+                                          # 0 disables time based rotation.
+! #log_rotation_size = 10MB
+                                          # Automatic rotation of logfiles will
+                                          # happen after that much (KB) log output.
+                                          # 0 disables size based rotation.
+--- 280,290 ----
+                                          # off, meaning append to existing files
+                                          # in all cases.
+  
+! log_rotation_age = 1d
+                                          # Automatic rotation of logfiles will
+                                          # happen after that (minutes)time.
+                                          # 0 disables time based rotation.
+! log_rotation_size = 0 
+                                          # Automatic rotation of logfiles will
+                                          # happen after that much (KB) log output.
+                                          # 0 disables size based rotation.