Crate postfix_log_parser

Source
Expand description

§Postfix Log Parser

一个基于组件的模块化Postfix日志解析器,采用与Postfix架构对应的设计模式。

§快速开始

use postfix_log_parser::parse_log_line;

let log_line = "Oct 15 14:23:45 mail postfix/smtpd[12345]: connect from client.example.com[192.168.1.100]";
let result = parse_log_line(log_line);

match result.event {
    Some(event) => println!("解析成功: {:?}", event),
    None => println!("解析失败: {:?}", result.parsing_errors),
}

Re-exports§

pub use error::ParseError;
pub use error::ParseResult;
pub use events::ComponentEvent;
pub use events::PostfixLogEvent;
pub use master_parser::BaseLogInfo;
pub use master_parser::MasterParser;

Modules§

cli
components
组件解析器模块
error
events
Postfix 日志事件定义模块
file_processor
formatters
master_parser
parsing
utils

Functions§

parse_log_line
解析单行Postfix日志的便捷函数
parse_log_lines
批量解析多行日志