Merge pull request #28439 from geekpi/translating

translated
This commit is contained in:
geekpi 2023-01-16 08:45:05 +08:00 committed by GitHub
commit 8c759b665b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 131 additions and 127 deletions

View File

@ -1,127 +0,0 @@
[#]: subject: "lnav: Advanced Log File Viewer for Linux Desktops and Servers"
[#]: via: "https://www.debugpoint.com/advanced-log-file-viewer-lnav-ubuntu-linux/"
[#]: author: "Arindam https://www.debugpoint.com/author/admin1/"
[#]: collector: "lkxed"
[#]: translator: "geekpi"
[#]: reviewer: " "
[#]: publisher: " "
[#]: url: " "
lnav: Advanced Log File Viewer for Linux Desktops and Servers
======
**If you want to debug or troubleshoot any issues, you need an advanced log file viewer like lnav which works wonders in the terminal for any Linux system.**
### lnav: Log file viewer
lnav can unzip all the compressed log files on the fly and merge them together for a nice display. The display is parsed and formatted based on the types of errors/warnings this helps to quickly glance through the thousands of logs, especially in servers.
While analysing the logs, timestamps are very important. So lnav merges multiple logs based on timestamps, which is very helpful for tracking down system issues.
Most of the important log file format detection is built-in; see below:
- Common Web Access Log format
- CUPS page_log
- Syslog
- Glog
- VMware ESXi/vCenter Logs
- dpkg.log
- uwsgi
- “Generic” Any message that starts with a timestamp
- Strace
- sudo
- GZIP, BZIP
That is not all; lnav is also capable of the below features, making it an important app for Linux systems.
- Filter messages based on regular expression
- A timeline view of errors
- Pretty-Print view- helps to reformat
- Query Log using SQL
- A log is updated in real-time while being searched.
- Syntax highlight via regular expression (say you want to find out an IP address in the entire log)
- Tab completion of any word from the log which is displayed !!
![lnav-running-in-ubutu][1]
To view the screenshots of the above features and learn more, visit [this page.][2]
### How to Install
This program is available in official Ubuntu, Debian repo. Install it using the following command.
```
sudo apt install lnav
```
And for Fedora, RHEL users, use the below command:
```
sudo dnf install lnav
```
Also the developers provides an offline standalone executable which you dont need to install. You can download the zip from the [GitHub release page][3] and execute as:
```
./lnav
```
**Note**: Its also available for macOS which you can find in the above GitHub page.
### lnav: How to use (Basics)
The simple command syntax is:
```
lnav [options] [logfile1 logfile2 …]
```
If you run just lnav from the command, it shows all the logs from your system (/var/log/messages and /var/log/syslog)
```
lnav
```
To view any specific log file, provide it via the command line:
```
lnav /var/log/syslog
```
Add timestamp in your log output using -t parameter
```
lnav -t /var/log/syslog
```
Here are some of the key switches of lnav
```
-d file Write debug messages to the given file.-a Load all of the most recent log file types.-r Load older rotated log files as well.-t Prepend timestamps to the lines of data being read inon the standard input.-w file Write the contents of the standard input to this file.-c cmd Execute a command after the files have been loaded.-f path Execute the commands in the given file.-n Run without the curses UI. (headless mode)
```
![lnav running in Ubuntu 22.04][4]
For further reading and exploration, visit the [official documentation][5].
[Next:How to Make LibreOffice Look Like Microsoft Office][6]
--------------------------------------------------------------------------------
via: https://www.debugpoint.com/advanced-log-file-viewer-lnav-ubuntu-linux/
作者:[Arindam][a]
选题:[lkxed][b]
译者:[译者ID](https://github.com/译者ID)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://www.debugpoint.com/author/admin1/
[b]: https://github.com/lkxed
[1]: https://www.debugpoint.com/wp-content/uploads/2016/11/lnav-Running-in-Ubutu.png
[2]: http://lnav.org/features/
[3]: https://github.com/tstack/lnav/releases/
[4]: https://www.debugpoint.com/wp-content/uploads/2016/11/lnav-running-in-Ubuntu-22.04.jpg
[5]: https://docs.lnav.org/en/latest/intro.html
[6]: https://www.debugpoint.com/libreoffice-like-microsoft-office/

View File

@ -0,0 +1,131 @@
[#]: subject: "lnav: Advanced Log File Viewer for Linux Desktops and Servers"
[#]: via: "https://www.debugpoint.com/advanced-log-file-viewer-lnav-ubuntu-linux/"
[#]: author: "Arindam https://www.debugpoint.com/author/admin1/"
[#]: collector: "lkxed"
[#]: translator: "geekpi"
[#]: reviewer: " "
[#]: publisher: " "
[#]: url: " "
lnav: 用于 Linux 台式机和服务器的高级日志文件浏览器
======
**如果你想调试或排除任何问题,你需要一个像 lnav这样的高级日志文件查看器。它在任何 Linux 系统的终端都能创造奇迹。**
### lnav: 日志文件查看器
lnav 可以即时解压缩所有的压缩日志文件,并将它们合并在一起进行漂亮的显示。显示是根据错误/警告的类型进行解析和格式化的,这有助于快速浏览成千上万的日志,特别是在服务器中。
在分析日志的时候,时间戳是非常重要的。所以 lnav 根据时间戳合并多个日志,这对追踪系统问题很有帮助。
大多数重要的日志文件格式检测都是内置的,如下:
- 常见的网络访问日志格式
- CUPS page_log
- Syslog
- Glog
- VMware ESXi/vCenter 日志
- dpkg.log
- uwsgi
- “通用”:任何以时间戳开头的信息
- Strace
- sudo
- GZIP, BZIP
这还不是全部lnav 还能实现以下功能,使其成为 Linux 系统的重要应用。
- 根据正则表达式过滤消息
- 错误的时间轴视图
- 漂亮的打印视图,这有助于重新格式化
- 使用 SQL 查询日志
- 在搜索时,日志会实时更新。
- 通过正则表达式高亮显示语法(比如你想在整个日志中找出一个 IP 地址)
- 显示的日志中任何单词的 Tab 补全!!
![lnav 在 ubuntu 中运行][1]
要查看上述功能的截图和了解更多信息,请访问[本页面][2] 。
### 如何安装
这个程序在 Ubuntu、Debian 的官方仓库中可以找到。使用以下命令安装它。
```
sudo apt install lnav
```
而对于 Fedora、RHEL 用户,使用下面的命令:
```
sudo dnf install lnav
```
另外,开发者还提供了一个离线的独立可执行文件,你不需要安装。你可以从 [GitHub 发布页][3]下载压缩包,然后按以下方式执行:
```
./lnav
```
**注意**:它也可用于 macOS你可以在上述 GitHub 页面找到。
### lnav: 如何使用(基础)
简单的命令语法是:
```
lnav [options] [logfile1 logfile2 …]
```
如果你只运行 lnav 命令,它会显示你系统中的所有日志(/var/log/messages 和 /var/log/syslog)
```
lnav
```
要查看任何特定的日志文件,在命令行中输入:
```
lnav /var/log/syslog
```
使用 -t 参数在你的日志输出中添加时间戳:
```
lnav -t /var/log/syslog
```
以下是 lnav 的一些关键开关:
```
-d file 将调试信息写入给定的文件。
-a 加载所有最新的日志文件类型。
-r 也加载较早的旋转日志文件。
-t 在标准输入中读入的数据行上预加时间戳。
-w file 将标准输入的内容写入该文件。
-c cmd 在文件加载后执行命令。
-f path 执行给定文件中的命令。
-n 不使用 curses UI 运行(无头模式)。
```
![lnav 在 Ubuntu 22.04 中运行][4]
要进一步阅读和探索,请访问[官方文档][5]。
--------------------------------------------------------------------------------
via: https://www.debugpoint.com/advanced-log-file-viewer-lnav-ubuntu-linux/
作者:[Arindam][a]
选题:[lkxed][b]
译者:[geekpi](https://github.com/geekpi)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://www.debugpoint.com/author/admin1/
[b]: https://github.com/lkxed
[1]: https://www.debugpoint.com/wp-content/uploads/2016/11/lnav-Running-in-Ubutu.png
[2]: http://lnav.org/features/
[3]: https://github.com/tstack/lnav/releases/
[4]: https://www.debugpoint.com/wp-content/uploads/2016/11/lnav-running-in-Ubuntu-22.04.jpg
[5]: https://docs.lnav.org/en/latest/intro.html