FedoraForum.org - Fedora Support Forums and Community
Results 1 to 3 of 3
  1. #1
    Join Date
    Nov 2016
    Location
    Cape Canaveral
    Posts
    41
    Windows 7 Firefox 60.0

    Keep Log File Size to 32k

    Hello,

    What is the easiest way to keep a history type log file to a maxsize of 32k keeping the newest entries?

    The truncate command looks close but will add lines if it is smaller than the size indicated I think.


    Thanks for your advice,

    Michael

  2. #2
    Join Date
    Apr 2009
    Location
    central NY, USA
    Posts
    1,090
    Linux Firefox 52.0

    Re: Keep Log File Size to 32k

    I have a 'startup' log file on my server that I keep to 10 lines. My method (of very LOW elegance) is to 'tail -9' the log to another file, then "mv" this temp file to the original file name (over-writing it) before the current entry gets appended to it..

    'Klutsy', but it's working for uneducated me.

    ;-)
    Change - the only constant.

  3. #3
    Join Date
    Oct 2006
    Location
    CN99CF Agassiz BC Canada
    Posts
    396
    Linux (Fedora) Firefox 60.0

    Re: Keep Log File Size to 32k

    Another approach would be setup logrotate and set the maxsize or size directives in the logrotate configuration file. Read through 'man logrotate'.
    -----
    f26 x86_64 Acer Predator G5910 Quad core Intel(R) Core(TM) i7-2600 CPU @ 3.40GHz

Similar Threads

  1. vnc log file size
    By roostertn in forum Using Fedora
    Replies: 1
    Last Post: 19th April 2010, 04:24 PM

Tags for this Thread

Posting Permissions

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