Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1u2r1a-006seJ-Pc for pgsql-general@arkaria.postgresql.org; Thu, 10 Apr 2025 12:28:54 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1u2r1Z-00BEmH-6Z for pgsql-general@arkaria.postgresql.org; Thu, 10 Apr 2025 12:28:53 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1u2r1Y-00BEm7-Rt for pgsql-general@lists.postgresql.org; Thu, 10 Apr 2025 12:28:53 +0000 Received: from mail-pl1-x632.google.com ([2607:f8b0:4864:20::632]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1u2r1X-004WQb-0X for pgsql-general@lists.postgresql.org; Thu, 10 Apr 2025 12:28:52 +0000 Received: by mail-pl1-x632.google.com with SMTP id d9443c01a7336-224019ad9edso9759885ad.1 for ; Thu, 10 Apr 2025 05:28:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1744288129; x=1744892929; darn=lists.postgresql.org; h=to:subject:message-id:date:from:mime-version:from:to:cc:subject :date:message-id:reply-to; bh=pqfhbdY3wgmKeLGca+LK8iDeLMC+Vr5adh4c0wOtNyQ=; b=QTsnks+iw3bo7gUKF23A14CiDVV8qfYERFjgy4onxh8AK1530tix+gli1OL/MwN7FO TqA8dDYkN3QR71nB6IedM2vcpQXC86QYN/P9RY/WY3pPEVUMCuI1Aon4bf1+iEbwmPws zBVBVKXrlG/tT6V45a+0aw3Oq+ynNGUvTaP6oe0dfUoPgXoePKy60irk8uP9pCm6/3Dc pyecdylcz2rLRxzHp63/nOlLrCTPzn2TAZwokCnPEViBxjzMv1vLyCRsa/D50M83eoa+ 08YfPNQNqLlUvHvyoJvoR9s4d+DaLZ+gXFmI0L5nWGSHeYZQpGxX2lvnMMwhLhwZo56F pU4w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1744288129; x=1744892929; h=to:subject:message-id:date:from:mime-version:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=pqfhbdY3wgmKeLGca+LK8iDeLMC+Vr5adh4c0wOtNyQ=; b=cQqaAlU+TZKwQIM/T1Cape6jl2lmtWhkReWkphjACh6U+xx0+BIjeRCysopX10rXsm xAxh8zqDOq/CSw7SPPbIETcUImDlhAcbyjMCVz+Gg6v68vnxawhFfrfMFl594ldR/bQ+ nknwIUSaByk3tKGUZpSojDf5rxSrl44ujrbAZwXY0KfFGyDTixX5l6nY1+eoEGk+zdgR qsQLTxEWtfuX8CrqDO0XyQ+UiTCTAPbMgk4IbyCJK/2DTYFLXo/X7k5tpyhcqhHEwYKV RzH1YHSnXNjXN8i63DM/Rb+fmbZuK1Dv6RZ5uRSLpqpQ4r2Cjsr4HussiKpn2wuw/8q3 A25g== X-Gm-Message-State: AOJu0YyWK1ufaWqrb3xNiHcplKBNCdB24FvgXEJ2H0Y5v/vZfGAgUFpR xSU0d0DXgLYGdhxreO9PX9uAf5rLEq9Rv3548bytT+/2LLKLpKi4ucfJM9WNKhQpv9CRxIK55VW q7P7b+6YRsSzQE3D8SFcKR+5jmovFHQmB X-Gm-Gg: ASbGncuFvGpgMcMs428m9E9s1EoElcKc1D4UDcOwE9Fy8wAlwQEbuN/mJrP6TJurYCR aWdKF9uPj1ZQCFvRR5zFlCDLE8j9CvJvUGVAfOEN/DmRdH/ZA1f+HULlHkt/CDIYgcjFR1dmF6u Hz8geZ8HWaPoOM2QwDyg8AaQSR X-Google-Smtp-Source: AGHT+IE2pqmF1CDcrACOnr1NTlfHECAV18ikY9G3JTFLRAgV97ls/3hy4jaPyHqDpfw8NCYSJn/nJntFeef90tVXnnM= X-Received: by 2002:a17:903:2304:b0:220:f795:5f14 with SMTP id d9443c01a7336-22b2ede88fcmr37996285ad.27.1744288128788; Thu, 10 Apr 2025 05:28:48 -0700 (PDT) MIME-Version: 1.0 From: Justin Swanhart Date: Thu, 10 Apr 2025 08:28:36 -0400 X-Gm-Features: ATxdqUFvkU-LGfBcYUshZVwEeAuleQZ6ModEdk2hmVj-hlWzhkDikw3LUxqiBd8 Message-ID: Subject: Archive logging not cleaning up pg_wal directory To: pgsql-general@lists.postgresql.org Content-Type: multipart/alternative; boundary="0000000000004d758706326bbad0" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --0000000000004d758706326bbad0 Content-Type: text/plain; charset="UTF-8" Hi, I have the following in my postgresql.conf for archive logging: archive_command='test ! -f /var/lib/postgresql/prod_archive_logs/%f && cp %p /var/lib/postgresql/prod_archive_logs/%f' This command is properly copying the log files to my archive directory but they remain in the `pg_wal` directory after they are copied, consuming hundreds of gigs of space. Am I supposed to create a cron job to clean out the `pg_wal` directory periodically (keep only 1 day of logs I guess?) I tried to use mv: archive_command='test ! -f /var/lib/postgresql/prod_archive_logs/%f && mv %p /var/lib/postgresql/prod_archive_logs/%f' When I did this the archives were moved away to the archive directory but when I tried to set up replication the server could not find the archived log to replicate from so I changed it to "cp" and now have this problem. What am I missing? Regards, --Justin --0000000000004d758706326bbad0 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Hi,

I= have the following in my postgresql.conf for archive logging:
archive_c= ommand=3D'test ! -f /var/lib/postgresql/prod_archive_logs/%f &&= cp %p /var/lib/postgresql/prod_archive_logs/%f'

This command is properly copying the log files to my archive directory b= ut they remain in the `pg_wal` directory after they are copied, consuming h= undreds of gigs of space.=C2=A0 Am I supposed to create a cron job to clean= out the `pg_wal` directory periodically (keep only 1 day of logs I guess?)=

I tried to use mv:
archive_command=3D'test ! -f /= var/lib/postgresql/prod_archive_logs/%f && mv %p /var/lib/postgresq= l/prod_archive_logs/%f'

When I did this the ar= chives were moved away to the archive directory but when I tried to set up = replication the server could not find the=C2=A0archived log to replicate fr= om so I changed it to "cp" and now have this problem.
<= br>
What am I missing?

Regards,

--Justin
--0000000000004d758706326bbad0--