Logrotate Windows files from Linux

I could not find a simple and free application to rotate log files on Windows. So, I used Linux to rotate log files on my Windows machine.

1. Configure the Windows Folder which has the log files, for sharing

2. Enable Read/Write Permissions
3. Mount the Windows Folder on Linux. Check out my post on how to Share Windows files with Linux - Share Windows Files with Linux

4. Now, create a file in /etc/logrotate.d to do the rotation. 

    In the below config, I am rotating the log files daily and saving the previous five copies

    root@localhost# more /etc/logrotate.d/winfiles

    /mnt/win/files.txt {
        daily
        rotate 5
        missingok
        compress
    }

Share Windows Files with Linux

- Install mount.cifs

        yum install cifs-utils -y

- Create a directory where you want the Windows folder 

root@localhost#mkdir /mnt/win

- Use mount.cifs  with the windows machine IP, folder and credentials to mount

root@localhost#sudo mount.cifs //10.4.23.67/Syslogs/ /mnt/win/ -o user=administrator,pass=password

root@localhost#
root@localhost#ls /mnt/win/
Documents Downloads
root@localhost#