From owner-freebsd-questions@freebsd.org Tue Sep 28 21:18:47 2021 Return-Path: Delivered-To: freebsd-questions@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id BD5526AC0FC for ; Tue, 28 Sep 2021 21:18:47 +0000 (UTC) (envelope-from freebsdlists.admin@protonmail.com) Received: from mail-4325.protonmail.ch (mail-4325.protonmail.ch [185.70.43.25]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "protonmail.com", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HJsnL4FNXz4tSL for ; Tue, 28 Sep 2021 21:18:46 +0000 (UTC) (envelope-from freebsdlists.admin@protonmail.com) Date: Tue, 28 Sep 2021 21:18:36 +0000 To: Dan Langille From: JB Cc: freebsd-questions@freebsd.org Reply-To: JB Subject: Re: auditdistd - audit trail file retntion Message-ID: In-Reply-To: <587952f9-71e1-590c-aacb-1a4c8be7e053@langille.org> References: <63FzSG9SYK55EYli0V-lgAHWQu0WKoRYoAz1IFKsq8kpIoC3TXLG765IctTawyK_DAYGU4yRzG_MPYFm6bfCujEEMLjPtLumNDhAUcsQO0E=@protonmail.com> <587952f9-71e1-590c-aacb-1a4c8be7e053@langille.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-1.2 required=10.0 tests=ALL_TRUSTED,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM shortcircuit=no autolearn=disabled version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on mailout.protonmail.ch X-Rspamd-Queue-Id: 4HJsnL4FNXz4tSL X-Spamd-Bar: --- X-Spamd-Result: default: False [-3.78 / 15.00]; HAS_REPLYTO(0.00)[freebsdlists.admin@protonmail.com]; ARC_NA(0.00)[]; R_DKIM_ALLOW(-0.20)[protonmail.com:s=protonmail]; REPLYTO_EQ_FROM(0.00)[]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; FREEMAIL_FROM(0.00)[protonmail.com]; R_SPF_ALLOW(-0.20)[+ip4:185.70.43.0/24]; MIME_GOOD(-0.10)[text/plain]; FREEMAIL_REPLYTO(0.00)[protonmail.com]; NEURAL_HAM_LONG(-1.00)[-1.000]; TO_MATCH_ENVRCPT_SOME(0.00)[]; DKIM_TRACE(0.00)[protonmail.com:+]; RCPT_COUNT_TWO(0.00)[2]; DMARC_POLICY_ALLOW(-0.50)[protonmail.com,quarantine]; NEURAL_HAM_SHORT(-0.78)[-0.783]; NEURAL_HAM_MEDIUM(-1.00)[-1.000]; RCVD_COUNT_ZERO(0.00)[0]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; FREEMAIL_ENVFROM(0.00)[protonmail.com]; ASN(0.00)[asn:62371, ipnet:185.70.43.0/24, country:CH]; MID_RHS_MATCH_FROM(0.00)[]; MAILMAN_DEST(0.00)[freebsd-questions]; RWL_MAILSPIKE_POSSIBLE(0.00)[185.70.43.25:from] X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Sep 2021 21:18:47 -0000 On Tuesday, September 28th, 2021 at 7:34 AM, Dan Langille wrote: > > Date: Mon, 20 Sep 2021 11:07:34 -0400 > > From: Dan Langille dan@langille.org > > To: "freebsd-questions@freebsd.org" freebsd-questions@freebsd.org > > Cc: Pawel Jakub Dawidek pjd@freebsd.org > > Subject: auditdistd - audit trail file retntion > > > > Hello, > > > > I am using auditdistd on FreeBSD 11.4 and 12.2 - I write about audit > > trail files retention. > > > > Is there an option to dispose of older logs in /var/audit/dist ? > > > > So far, it seems like a custom cronjob is in order. Something like: > > > > ??? /usr/bin/find /var/audit/dist -type f -mtime +7 -exec rm {} \; > > > > FYI: I have read up about auditd, /etc/security/audit_control, and the > > audit -e option. They do not apply to auditdistd. > > > > Thank you. > > > This is what I'm using from a periodic daily script: > > /usr/bin/find -E /var/audit/dist -type f -mtime +7 -regex "/var/audit= /dist/[0-9]+.[0-9]+" -exec rm {} \; > > Dan Langille > > dan@langille.org Looks good. You can use the "-delete" flag instead of "-exec rm {} \;" but = it shouldn't make much difference. Also, the `cron' default PATH includes /= usr/bin, so you can probably just use `find' instead of absolute path (that= 's why the "-exec rm" isn't complaining about a missing `rm' program). Again not that it makes much difference, but you can use the exclusion "!" = flag to match the single "*.not_terminated" file, then nuke all other files= inside that dir without needing the "-regex". find /var/audit/dist/ ! -name "*.not_terminated" -type f -mtime +7 -delete Sent with ProtonMail Secure Email.