You say you "cannot stop the application because it is a critical app...", and in the OP you said "this file is overwelming my filesystem." This is not clear.

Is the app somehow able to keep running even when the filesystem is overwhelmed? Does the system never shut down at all? Is there no maintenance window, power outage or any other interruption in this critical app's operation?

Surely there must be a point when the app stops, and when that happens, reconfigure its logging protocol before it starts again. Have its log output write to some sort of log rotation tool, as suggested above.

As for your failed attempts to truncate the log file, perhaps this is a permission issue? What user/group owns the file and the directory that contains it? What are the permission modes on the file and on the directory that contains it? A user with adequate permission should be able to truncate the file. (Before truncating it, is it being backed up, and is that important?)

Update: this is turning out to be a non-perl problem, unless you want to ask about how to re-invent log rotation in perl. Your options depend on knowing more about the app that is generating all this log data (and since it's not a perl app, we aren't talking about perl questions). You need to know things like:

Is it a daemon that starts at boot time, or is it started some other way? Is there no control over the amount of logging output (either a config file or command line options at startup)? Does it require a specific file path/name to be the log file, or is it simply being started with stdout and/or stderr being redirected to this "overwhelming" file? Is the log info really useless (could you just redirect it to /dev/null)?

Chances are, if you learn about that stuff, you'll find out how to solve the problem.


In reply to Re^3: File Locking and other apps by graff
in thread File Locking and other apps by jmaya

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.