用于 Linux 的日志解析器

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/6367312/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-05 04:34:14  来源:igfitidea点击:

Log Parser for linux

linuxlogginglogparser

提问by Sanghyun Lee

Log Parseris great tool for parsing log files. I can parse not just IIS log files but also custom log files with it.

Log Parser是解析日志文件的好工具。我不仅可以解析 IIS 日志文件,还可以使用它解析自定义日志文件。

For exampleI can use SQL syntax to parse logs:

例如我可以使用 SQL 语法来解析日志:

C:\>LogParser "SELECT TimeGenerated, SourceName, 
EventCategoryName, Message INTO report.txt FROM Security WHERE 
EventID = 528 AND SID LIKE '%TESTUSER%'" -resolveSIDs:ON

Is there any tool like that for linux?

有没有类似的Linux工具?

Thanks.

谢谢。

采纳答案by thebodzio

lnavsupports SQL queries and supports most of the common Linux log formats. Look at the project's websiteand documentation pagefor more details and screenshots.

lnav支持 SQL 查询并支持大多数常见的 Linux 日志格式。查看项目的网站文档页面以获取更多详细信息和屏幕截图。

回答by Vamsi Krishna B

have you tired tail command ?

你厌倦了tail命令吗?

tail -f /path/to/log/file/log

if you prefer a log viewer with GUI, Have a look at Gnome Log Viewer

如果您更喜欢带有 GUI 的日志查看器,请查看 Gnome 日志查看器

回答by thebodzio

Maybe you'll take a look at multitail?

也许你会看看multitail

When it comes to text based logs grepis your friend—it can do pretty much the same what SQL-like syntax in your example.

当涉及到基于文本的日志时,它grep是您的朋友——它可以执行与您的示例中类似 SQL 的语法几乎相同的操作。