/usr/lib/ntp/rotate-stats is in ntpsec 1.1.0+dfsg1-1.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49  | #!/bin/sh
# The package default /etc/ntp.conf suggests (and the ntpviz package
# /etc/ntp.d/ntpviz.conf enables) logging of various statistics to
# the /var/log/ntpstats directory.  The daemon automatically changes
# to a new datestamped set of files at midnight, so all we need to do
# is delete old ones, and compress the ones we're keeping so disk
# usage is controlled.
statsdir=$(grep -v '^#' /etc/ntp.conf | sed -nr 's/^statsdir[[:space:]]+([^[:space:]]+).*$/\1/p')
# The ntpsec package, unlike ntp, uses /var/log/ntpstats as the default for
# statsdir.
if [ -z "$statsdir" ]; then
	statsdir=/var/log/ntpstats
fi
if [ -d "$statsdir" ]; then
	# only keep a week's depth of these. Delete only files exactly
	# within the directory and do not descend into subdirectories
	# to avoid security risks on platforms where find is not using
	# fts-library.
	find "$statsdir" -maxdepth 1 -type f -mtime +7 -delete
	# compress whatever is left to save space but make sure to really
	# do it only in the expected directory.
	cd "$statsdir" || exit 1
	for pattern in "*stats.????????" "gpsd.????-??-??" "temps.????-??-??"
	do
		ls -d -- $pattern > /dev/null 2>&1
		if [ $? -eq 0 ]; then
			# Note that gzip won't compress the file names that
			# are hard links to the live/current files, so this
			# compresses yesterday and previous, leaving the live
			# log alone.  We suppress the warnings gzip issues
			# about not compressing the linked file.
			gzip --best --quiet -- $pattern
			return=$?
			case $return in
			    2)
				# squash all warnings
				;;
			    *)
				exit $return # but let real errors through
				;;
			esac
		fi
	done
fi
 |