log日志有5G,如何打开?

WBOY
Release: 2016-07-06 13:53:54
Original
2260 people have browsed it

想分析下日志,居然有5G,不知道有什么工具能打开,试了两个文本分割器,也打不开,更不用数分割了,求方法,求好用的文本分割器。
感谢大家提供这么多的方法!

回复内容:

想分析下日志,居然有5G,不知道有什么工具能打开,试了两个文本分割器,也打不开,更不用数分割了,求方法,求好用的文本分割器。
感谢大家提供这么多的方法!

这个打开是做什么? 是想看看里面的部分内容吗?日志一行一行的,可以先用head命令查看前多少行,觉得不够再用tail查看后面多少行是啥。 如果想从日志里面提出东西可以用awk命令来一行一行处理。 如果处理逻辑的比较多的话,就用python吧, Python中的file('log.log','r')就是一个行迭代器,占内存很少。
如果是想直接用可视化工具打开的话,前面说的ultraEdit64位可以做到

推荐使用EmEditor,下图截取自官网介绍。

log日志有5G,如何打开?

可以用fopen/while(!feof($fp))/fgets逐行遍历文件进行操作:

<code><?php header('Content-Type: text/plain; charset=utf-8');
$file = __FILE__;
$fp = fopen($file, 'r');
$count = 0;
while ( !feof($fp) ) {
    $line = fgets($fp);
    //echo $count.': '.$line;
    $count++;
}
fclose($fp);</code></code>
Copy after login

使用linux的split就好了

<code>split -b 100m your_file</code>
Copy after login

用ultraEdit64位试试

日志分析推荐 awk

不够规范呀..
在日志处理的时候不是要设置上限,分类分级别归档吗,扯了5个G,很蛋疼..

用python生成器试一下

UltraEdit 这个有试过打开2G多的日志文件,但是7G的没试过。

less 可以查看文件!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!