syslog 是 Linux 中最常见的日志格式,它包含时间戳、主机名、应用程序名称、日志级别和日志消息等信息。例如:
May 15 10:45:36 myhost sshd[1234]: Accepted password for user from 192.168.1.100
journald 是 systemd 引入的新型日志系统,它采用二进制格式存储日志,提供更丰富的元数据信息。通过 journalctl 命令可查看日志。例如:
May 15 10:45:36 myhost sshd[1234]: Accepted password for user from 192.168.1.100
Apache 网络服务器有两种常见的日志格式:访问日志和错误日志。访问日志记录每个 HTTP 请求的详细信息,错误日志记录 Apache 服务器运行过程中的错误信息。例如:
127.0.0.1 - - [15/May/2023:10:45:36 +0800] "GET /index.html HTTP/1.1" 200 1024
Nginx 也有两种常见的日志格式:访问日志和错误日志。Nginx 日志格式与 Apache 类似,但可自定义更多信息。例如:
192.168.1.100 - - [15/May/2023:10:45:36 +0800] "GET /index.html HTTP/1.1" 200 1024 "-" "Mozilla/5.0"