Technitribe

interesting problems (and a few solutions, too)

Technitribe
  • About the Authors
  • Log In
  • Log Out
  • Lost Password
  • Register
  • Reset Password
    • 9 Sep 2009

      Because old archived logs on secure servers are pointless…

      Written by ajfarrell

      Often we get Nagios alerts letting us know that your kernel is about to panic and your server is going to crash and die because read/write operations are going to FAIL MISERABLY.

      Obviously being a systems administrator it becomes your job to figure out what can go, what needs to stay, et al.

      I’ve found that archived logs (logrotate) on a secure server often can be quite large. And on a low-end configuration with a server with only 40G it becomes a nuisance when you have a few Gb of data…
      And you all probably know this, but Tim asked when I’d blog. So… I’ll make sure!
      Having 40 or 50 files is a pain to manually delete. Sure, you could probably rm -f *.1 *.2 *.3 etc etc etc but that becomes too much of a pain.

      On BSD systems there is an awesome counter called ‘jot’; it works exactly the opposite of the GNU command ‘seq’; so for a rudimentary example to remove all files it becomes a simple one liner–

      • jot 6 1 |while read i; do rm -f *.${i};done
      • seq 1 6|while read i; do rm -f *.${i};done

      In Emeril fashion: BAM! You’re now out of the clear.

      • Tags »

    One Comment on “Because old archived logs on secure servers are pointless…”

    • tbielawa

      10 Sep 2009 02:09 pm

      See also:

      rm *.[1-6]

      Bash is fantastic!

    Leave a Reply Cancel reply

    Your email address will not be published. Required fields are marked *

    • The Authors
    • Virtual Disk Guide

      Interested in virtualization? Do QCOWs rule your filesystem? Are you a libvirt or KVM+QEMU wizard? I wrote a book about virtual disk management. Check out the The Linux Sysadmin's Guide to Virtual Disks online for free at ScribesGuides.com.


      Consider supporting the author by purchasing a hard copy of the first edition for just $10.00 on Lulu.com.

    • bitmath

      bitmath is a Python library for dealing with file size units (GiB's, kB's, etc) in a sane way. bitmath supports arithmetic, rich comparison, conversion, automatic best human-readable representation, and many other utility functions. Read some examples on the docs site or check out the source on GitHub.

    • latest posts

      • Querying block device sizes in Python on Linux and Mac OS X February 4, 2023
      • Using jq to filter an array of objects from JSON September 9, 2019
      • Two Year Break — And we’re back! November 16, 2018
    • tags

      bitmath blog conference css dblatex DNS DocBook eclipse Emacs Erlang Fedora fedora 22 filter GNU Screen Haiku Introduction java jboss LCSEE Linux locale locales fix slicehost ubuntu Macports module nist nXML-Mode opengl open source OS X package packaging pki prefix units presentation project pypi Python scholarship si summit Tutorial ubuntu xcode XML XMPP
    • h4ck teh world

      tbielawatbielawa
      • Issue Comment
        bitmath
        February 6, 2023 - 12:55 am UTC
      • Issue Comment
        bitmath
        February 6, 2023 - 12:54 am UTC
      • Push
        bitmath
        February 6, 2023 - 12:51 am UTC
      • Issue Comment
        bitmath
        February 6, 2023 - 12:36 am UTC
      • Push
        bitmath
        February 6, 2023 - 12:30 am UTC

Creative Commons License
Technitribe by Tim Bielawa is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.