Results 1 to 4 of 4
Thread: File redirection
Enjoy an ad free experience by logging in. Not a member yet? Register.
- Join Date
- Apr 2010
I am a Newbie to Linux.
I have a folder LOGS under the path /d01/App1/LOGS. Since my application generates lots of log files under this LOGS directory , I have been asked to move this to the different path which is in a different file system /d00/LOGS.
My application is configured in such a way that the log files will be written only under this path /d01/App1/LOGS. All I have to do is to re direct this path to /d00/LOGS.
So when my application is trying to write a log file under this /d01/App1/LOGS path , all it has to do is not write in that path instead it has to write in /d00/LOGS path.
I tried to use symbolic soft links but could not succeed in achieving the same.
Would appreciate the help on this.
Can this application be configured by a conf file to use another log directory or is the path hardcoded to /d01/App1/LOGS ?
If it would be hardcoded: File a ticket for the responsible developer.
If I understand correctly, the server is already having problems, as you have been asked to move the logs. Disk space or performance issues maybe?
Two possible adhoc fixes:
a) introduce and configure logrotate.
The tool logrotate can make sure a logfile does not get bigger than X bytes, and keeps Y generations, optionally gzipping older files.
It will drop logfiles, that fall out of that rotation.
b) if you do need all the logs and there is enough space on /d00/LOGS, then you could do a "bind mount" from /d00/LOGS to /d01/App1/LOGS
- Shut down the application
- copy files from /d01/App1/LOGS to /d00/LOGS
- if the copy was succesful, delete them from /d01/App1/LOGS/
- define the bind mount in /etc/fstab
- mount /d01/App1/LOGS/
- start the application
The clean way:
- configure the application to use the new log path
- consider the use of logrotateYou must always face the curtain with a bow.
- Join Date
- Feb 2009
If the path is hard coded all over the app, and /d00 and /d01 are different file systems, then you are in deep doo-doo unless you have root access to `mount` as Irithori described.
I am curious as to why symlinks do not work. You can easily make /d01/App1/LOGS actually point to /d00/LOGS. Symlinks do not care about linking to a different filesystem.
ln -s /d00/LOGS /d01/App1/LOGS