concatenate compressed and uncompressed logs

2010-06-21 1 min read bash Linux

<span style="font-size: x-large;"><a href="http://feedproxy.google.com/~r/Command-line-fu/~3/iwFUyltYgjM/concatenate-compressed-and-uncompressed-logs">concatenate compressed and uncompressed logs

$ find /var/log/apache2 -name 'access.loggz' -exec <a class="zem_slink freebase/en/gzip" title="Gzip" rel="homepage" href="http://www.gzip.org/">zcat {} ; -or -name 'access.log' -exec cat {} ; This command allows you to stream your log files, including gziped files, into one stream which can be piped to <a class="zem_slink freebase/en/awk" title="AWK" rel="homepage" href="http://cm.bell-labs.com/cm/cs/awkbook/index.html">awk or some other command for analysis.

Note: if your version of &#8217;find&#8217; supports it, use:

find /var/log/apache2 -name 'access.loggz' -exec zcat {} + -or -name 'access.log' -exec cat {} +

  • <a href="http://www.commandlinefu.com/commands/view/5882/concatenate-compressed-and-uncompressed-logs">View this command to comment, vote or add to favourites
  • <a href="http://feeds2.feedburner.com/commands/by/recursiverse">View all commands by <a href="http://feeds2.feedburner.com/commands/by/recursiverse">recursiverse

<a href="http://www.commandlinefu.com"><img src="http://blog.amit-agarwal.co.in/wp-content/uploads/2010/08/header-logo.jpg" alt="commandlinefu.com" align="bottom" />

by David Winterbottom (<a href="http://codeinthehole.com">codeinthehole.com)

<a href="http://feedads.g.doubleclick.net/~a/mnZcA00-ZXLWCLqWniCVwaTXU4Y/0/da"><img src="http://blog.amit-agarwal.com/wp-content/uploads/img.zemanta.com/~a/mnZcA00-ZXLWCLqWniCVwaTXU4Y/0/di" border="0" alt="" align="bottom" />
<a href="http://feedads.g.doubleclick.net/~a/mnZcA00-ZXLWCLqWniCVwaTXU4Y/1/da"><img src="http://blog.amit-agarwal.com/wp-content/uploads/img.zemanta.com/~a/mnZcA00-ZXLWCLqWniCVwaTXU4Y/1/di" border="0" alt="" align="bottom" />

<img src="http://blog.amit-agarwal.com/wp-content/uploads/img.zemanta.com/~r/Command-line-fu/~4/iwFUyltYgjM" border="0" alt="" width="1" height="1" align="bottom" />

URL: <a href="http://feedproxy.google.com/~r/Command-line-fu/~3/iwFUyltYgjM/concatenate-compressed-and-uncompressed-logs">http://feedproxy.google.com/~r/Command-line-fu/~3/iwFUyltYgjM/concatenate-compressed-and-uncompressed-logs<h6 class="zemanta-related-title">Related articles by Zemanta <ul class="zemanta-article-ul"> <li class="zemanta-article-ul-li"><a href="http://www.alfajango.com/blog/how-to-combine-gzip-plus-cdn-for-fastest-page-loads/">How to Combine GZip + CDN for Fastest Page Loads (alfajango.com) <li class="zemanta-article-ul-li"><a href="http://trishussey.com/2010/06/16/get-ready-for-wordpress-3-backup-your-database/">Get Ready for WordPress 3: Backup Your Database (trishussey.com) <li class="zemanta-article-ul-li"><a href="http://www.phpied.com/uncompressed-data-in-base64-probably-not/">Uncompressed data in base64? Probably not (phpied.com) <li class="zemanta-article-ul-li"><a href="http://feedblog.org/2008/10/12/google-bigtable-compression-zippy-and-bmdiff/">Compression algorithms used by Google (feedblog.org) <div class="zemanta-pixie"><a class="zemanta-pixie-a" title="Enhanced by Zemanta" href="http://www.zemanta.com/"><img class="zemanta-pixie-img" src="http://blog.amit-agarwal.co.in/wp-content/uploads/2010/08/zemified_c9.gif" alt="Enhanced by Zemanta" /><span class="zem-script more-related more-info pretty-attribution paragraph-reblog">

comments powered by Disqus