Logrotate command not found

Hello, I’m struggling with logrotate.

I’ve set Log System : [Full], but when i try and use the logrorate command i get ‘-bash: logrotate: command not found’

I’ve set my logrotate.conf as

daily
rotate 4
create
compress
include /etc/logrotate.d

I also have various other confs in logrotate.d

I’m sure I’m missing something obvious…

What is the output of sudo systemctl status logrotate ?

RaspberryPi sudo systemctl status logrotate.service
● logrotate.service - Rotate log files
     Loaded: loaded (/lib/systemd/system/logrotate.service; static)
     Active: inactive (dead) since Thu 2023-04-27 00:00:04 BST; 7h ago
TriggeredBy: ● logrotate.timer
       Docs: man:logrotate(8)
             man:logrotate.conf(5)
   Main PID: 11361 (code=exited, status=0/SUCCESS)
        CPU: 758ms

Warning: journal has been rotated since unit was started, output may be incomplete.

Active: inactive (dead) since Thu 2023-04-27 00:00:04 BST; 7h ago
Looks like it is working.
What command did you use?

logrotate --force /etc/logrotate.d/rsyslog

and variants. i’ve modified some of the conf files and logs are now rotating ok, but not sure why the command itself isn’t working.

Did you try to run the command as root or as another user with sudo?
Where is logrotate? which logrotate

just tested on my Orange Pi 5 and the command logrotate is available ootb after switching the log mode to full.

root@DietPiOPi5:~# logrotate --version
logrotate 3.18.0

    Default mail command:       /usr/bin/mail
    Default compress command:   /bin/gzip
    Default uncompress command: /bin/gunzip
    Default compress extension: .gz
    Default state file path:    /var/lib/logrotate/status
    ACL support:                yes
    SELinux support:            yes
root@DietPiOPi5:~#

But yeah, it requires root permission as executable is located at /usr/sbin/logrotate

RaspberryPi which logrotate
RaspberryPi logrotate --version
bash: logrotate: command not found
RaspberryPi 

in /usr/sbin i have:

-rwxr-xr-x  1 root root      83420 Jan 30  2022 logrotate

which user you are using to login? Do you use root?

1 Like

just normal user. this really helped tho as using sudo all is fine :face_with_hand_over_mouth:

RaspberryPi sudo which logrotate
/usr/sbin/logrotate
RaspberryPi sudo logrotate
logrotate 3.18.0 - Copyright (C) 1995-2001 Red Hat, Inc.
This may be freely redistributed under the terms of the GNU General Public License        

Usage: logrotate [-dfv?] [-d|--debug] [-f|--force] [-m|--mail=command]
        [-s|--state=statefile] [--skip-state-lock] [-v|--verbose] [-l|--log=logfile]      
        [--version] [-?|--help] [--usage] [OPTION...] <configfile>

My bad, and thanks all for putting up with me.