Find the answer to your Linux question:
Results 1 to 4 of 4
Hi! I would like to make a question. I have a big log that it's increment continuous time. I would like that the script contents only 1 million of lines. ...
  1. #1
    Just Joined!
    Join Date
    Oct 2008
    Posts
    48

    clear lines of LOG file

    Hi!

    I would like to make a question.
    I have a big log that it's increment continuous time.

    I would like that the script contents only 1 million of lines. (About 250mb)
    When I execute: cat jxl.log | wc -l i see the exactly lines, but the question is: How can i make a maintenance to clear the lines increase 1 more line?

  2. #2
    Linux Newbie Themer's Avatar
    Join Date
    Feb 2008
    Posts
    171
    Quote Originally Posted by guif View Post
    i see the exactly lines, but the question is: How can i make a maintenance to clear the lines increase 1 more line?
    I would like to try and help, but I am afraid that this makes absolutely no sense whatsoever. Could you try to re-word the question, or explain a little better what exactly you are trying to do with the log file?
    When I find myself burried in errors, Windows Help appears to me; speaking words of wisdom, Reboot!

  3. #3
    Just Joined!
    Join Date
    Oct 2008
    Posts
    48
    ok. I explain another time.

    I have one log. This log increase continuous and i would like to control the size of this.
    I only like to have this log with 250Mb (about 1 million lines)


    How it's possible to control this??

  4. #4
    Linux Newbie Themer's Avatar
    Join Date
    Feb 2008
    Posts
    171
    Well, there may be several ways, but one could be to have a cron job that checks it's size, and then if it's greater than 250 Mb, remove the first few lines (so you always have the most recent 1 million), then check again - if it's stil to big, remove a few more lines, and so on until it's done. This loop should only take a fraction of a second to run, and should only need to execute every hour at most.
    When I find myself burried in errors, Windows Help appears to me; speaking words of wisdom, Reboot!

Posting Permissions

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