zcat

How to stream a gzip built on the fly in Python?

て烟熏妆下的殇ゞ 提交于 2021-02-08 09:51:15
问题 I'd like to stream a big log file over the network using asyncio. I retrieve the data from the database, format it, compress it using python's zlib and stream it over the network. Here is basically the code I use: @asyncio.coroutine def logs(requests): # ... yield from resp.prepare(request) # gzip magic number and compression format resp.write(b'\x1f\x8b\x08\x00\x00\x00\x00\x00') compressor = compressobj() for row in rows: ip, uid, date, url, answer, volume = row NCSA_ROW = '{} {} - [{}] "GET

Cron job for generate Go Access report not working

拈花ヽ惹草 提交于 2021-01-29 18:29:40
问题 In my root crontab ( sudo crontab -e ) I have this job to generate Go Access log reports: * * * * * goaccess /var/log/nginx/access.log -o /home/me/some/path/report.html It works just fine. I also have this job to generate a report that spans multiple days: * * * * * sudo zcat -f /var/log/nginx/access.log* | goaccess -o /home/me/some/path/bigger_report.html Cron says it runs but it doesn't actually seem to run. I've looked around and tried a bunch of things (including following the list here -

Alternate to PHP exec() function

泪湿孤枕 提交于 2019-12-04 00:40:10
问题 Currently I am using: exec("zcat $filename", $output) To uncompress a .Z type file but unfortunately my hosting company has now disabled this function. Is there a workaround? $pathtofile = "filename.lis.Z"; exec("zcat $pathtofile", $output); 回答1: do this echo ini_get("disable_functions"); to know if you are able to use one of the following: system(); exec(); passthru(); shell_exec(); but if it's a shared hosting all the above are for sure blocked and you will have to find an alternative 回答2:

Alternate to PHP exec() function

泄露秘密 提交于 2019-12-01 03:44:28
Currently I am using: exec("zcat $filename", $output) To uncompress a .Z type file but unfortunately my hosting company has now disabled this function. Is there a workaround? $pathtofile = "filename.lis.Z"; exec("zcat $pathtofile", $output); do this echo ini_get("disable_functions"); to know if you are able to use one of the following: system(); exec(); passthru(); shell_exec(); but if it's a shared hosting all the above are for sure blocked and you will have to find an alternative system($shell_command, $response_var); So in your case: system("zcat $filename", $output); .Z files are LZW

How to get few lines from a .gz compressed file without uncompressing

荒凉一梦 提交于 2019-11-29 19:41:41
How to get the first few lines from a gziped file ? I tried zcat, but its throwing an error zcat CONN.20111109.0057.gz|head CONN.20111109.0057.gz.Z: A file or directory in the path name does not exist. zcat(1) can be supplied by either compress(1) or by gzip(1) . On your system, it appears to be compress(1) -- it is looking for a file with a .Z extension. Switch to gzip -cd in place of zcat and your command should work fine: gzip -cd CONN.20111109.0057.gz | head On some systems (e.g., Mac), you need to use gzcat . On a mac you need to use the < with zcat: zcat < CONN.20111109.0057.gz|head If a

How to get few lines from a .gz compressed file without uncompressing

我们两清 提交于 2019-11-28 15:28:10
问题 How to get the first few lines from a gziped file ? I tried zcat, but its throwing an error zcat CONN.20111109.0057.gz|head CONN.20111109.0057.gz.Z: A file or directory in the path name does not exist. 回答1: zcat(1) can be supplied by either compress(1) or by gzip(1) . On your system, it appears to be compress(1) -- it is looking for a file with a .Z extension. Switch to gzip -cd in place of zcat and your command should work fine: gzip -cd CONN.20111109.0057.gz | head Explanation -c --stdout -