Find the answer to your Linux question:
Results 1 to 4 of 4
Hi All 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 , ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Apr 2010
    Posts
    1

    File redirection


    Hi All

    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.

    Thanks
    Rajesh.

  2. #2
    Trusted Penguin Irithori's Avatar
    Join Date
    May 2009
    Location
    Munich
    Posts
    3,425
    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
    Code:
    man mount
    The workflow for that quick fix would be:
    - 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 logrotate
    You must always face the curtain with a bow.

  3. #3
    Just Joined!
    Join Date
    Feb 2009
    Posts
    54
    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.

  4. $spacer_open
    $spacer_close
  5. #4
    Linux Guru Cabhan's Avatar
    Join Date
    Jan 2005
    Location
    Seattle, WA, USA
    Posts
    3,252
    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.
    Code:
    ln -s /d00/LOGS /d01/App1/LOGS
    When you run this, what error are you getting?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •