Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kiL1q-000438-Li for pgsql-admin@arkaria.postgresql.org; Thu, 26 Nov 2020 17:25:58 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1kiL1p-0004hv-Jl for pgsql-admin@arkaria.postgresql.org; Thu, 26 Nov 2020 17:25:57 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kiL1p-0004hn-90 for pgsql-admin@lists.postgresql.org; Thu, 26 Nov 2020 17:25:57 +0000 Received: from mail-ot1-x32b.google.com ([2607:f8b0:4864:20::32b]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1kiL1m-0007Lg-Vm for pgsql-admin@lists.postgresql.org; Thu, 26 Nov 2020 17:25:56 +0000 Received: by mail-ot1-x32b.google.com with SMTP id f12so2425782oto.10 for ; Thu, 26 Nov 2020 09:25:54 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:references:from:message-id:date:user-agent:mime-version :in-reply-to:content-transfer-encoding:content-language; bh=gaCVA3FDzhB4uN4JiCwNgA9ZeVKruRtJLoLvwZj025I=; b=Q2j4MxITpS22eaOUAhyyXX28lVdYRtd0NvQJ+U3ffzc7j/FHneWYgVHC5gIP3GFN9B ooRVzYqBRmQhB6OjyEeVyCJ0gq+wVgen+1qPviBcXT8IfNSf2raxNkFlsrqYXY7MBnF7 8/+2adHDoVuconAMZrGHAnCpSpYHVRb6Iz2cna+tch+DY6BF8aVcU/ex8WhSn+b0VJSi FWDMDTdVYuvtlECGyAugP6pCONCYN1NGrJVwuG6u8vGU6Xrp8/ElFZe3Wu+VrtP0s3w/ DsP/RlsroQIdlFdpvvNG6I0MavMajyBDCsm2CVAP8Omr6P6hT/wCmc3KGJdTjVdUOvlt KYLg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding :content-language; bh=gaCVA3FDzhB4uN4JiCwNgA9ZeVKruRtJLoLvwZj025I=; b=WgIiZD3Tj5YzNMZ9lGuHtoDvxFqsyIHi9/Bm+SVkLqUE+y+DMY8fHGMM3EXzZA9iV6 S6jOr9XiCXRfV/5i9Sa63yRxj+5brfGzuyyeCwqY8W32FO3ZRpRFgnVt8NmIAcKeX3i9 IoNjvFwjEncz53V2R0/ylbrMQDXOxYvV1gleL0+MI1EwmROtpVBrD24Wa8pS/ragLyZX TZodU/EavZmd6DCxmmKVtZWYQhZ5DKuRZhfr3Kef4fqEoS5TkXRISpYtC8u5TVXw6v97 B+8xxH7CE7014eNpdLyZPv9mBvHrfIvW/VILDLDbA3DsK+OekuJEMhvndBJ8p7fkQrma +G5g== X-Gm-Message-State: AOAM531aTVhPI0qxPSFqlJmAY47pVGUTyS8SsBNUc5nl/mehclSBo1Py CT5IrV/HbAW/FVnFbDNVCMrXW8+I9ieYaQ== X-Google-Smtp-Source: ABdhPJwl6B1G7/WaYa8B4bkNi6a34ERvTvomz03NomIxd4xbkIB2ebW/9yhWHLfo/4pDlx6ElkcJPQ== X-Received: by 2002:a9d:62c1:: with SMTP id z1mr3059644otk.108.1606411552385; Thu, 26 Nov 2020 09:25:52 -0800 (PST) Received: from [192.168.1.10] (ip174-67-141-204.no.no.cox.net. [174.67.141.204]) by smtp.googlemail.com with ESMTPSA id s131sm3532547oie.58.2020.11.26.09.25.51 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 26 Nov 2020 09:25:51 -0800 (PST) Subject: Re: current log file removal To: pgsql-admin@lists.postgresql.org References: From: Ron Message-ID: <53a8b79d-6031-45d8-b213-028183750251@gmail.com> Date: Thu, 26 Nov 2020 11:25:50 -0600 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-US List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk I set these values in postgresql.conf, then have a cron job which runs just after midnight that compresses yesterday's log files. That same cron job deletes compressed files older than X days. log_destination = 'stderr' logging_collector = on log_directory = '/your/data/location/12/pg_log' # assuming v12, of course log_filename = 'postgresql-%F.log' log_rotation_age = 1d On 11/26/20 8:03 AM, Holger Jakobs wrote: > The ordinary log rotation should do. > > These are the default settings (therefore commented with a # in > postgresql.conf): > > #log_rotation_age = 1d                  # Automatic rotation of logfiles will >                                         # happen after that time. 0 disables. > #log_rotation_size = 10MB               # Automatic rotation of logfiles will >                                         # happen after that much log output. >                                         # 0 disables. > > So your log files will not exceed 10 MB. > > Of course, you can to this manually as well. Just rename the current > logfile,  a new one will be created. > > Then gzip or bzip2 or xz the old one. > > Am 26.11.20 um 14:40 schrieb Yambu: >> Hi >> >> How can I safely remove the log file that is being used currently and zip >> it without interfering with the postgres server? >> >> We are running out of space on the server and the logs are eating a lot >> of space, we need to zip them without first stopping the server. >> >> regards > -- Angular momentum makes the world go 'round.