Create a file in the /etc/logrotate.d/ folder with the following text

/root/fan_speed/log/fan_speed.log{
        rotate 30
        hourly
        missingok
        notifempty
}
