#parser #logstash #string #map #plugin #extractor

dissect

由The Tremor Team启发的Logstash解析提取器

13个不稳定版本 (6个破坏性更新)

0.7.3 2023年10月26日
0.7.1 2023年9月26日
0.7.0 2023年5月24日
0.5.0 2022年11月3日
0.1.2 2020年3月4日

#50编程语言

Download history 161/week @ 2024-04-23 15/week @ 2024-04-30 311/week @ 2024-05-07 307/week @ 2024-05-14 285/week @ 2024-05-21 260/week @ 2024-05-28 212/week @ 2024-06-04 451/week @ 2024-06-11 577/week @ 2024-06-18 276/week @ 2024-06-25 285/week @ 2024-07-02 314/week @ 2024-07-09 330/week @ 2024-07-16 514/week @ 2024-07-23 247/week @ 2024-07-30 164/week @ 2024-08-06

1,276 每月下载量
2 个crate中使用(通过 tremor-script

Apache-2.0

67KB
1.5K SLoC

Rust 1K SLoC // 0.0% comments Shell 235 SLoC // 0.0% comments

Dissect   最新版本 构建状态 质量检查 许可证检查 安全检查 代码覆盖率

dissect 解析器


Dissect 解析器受 logstash 的 dissect 插件的启发。

将字符串解析为映射。

作为库使用

Dissect 解析器被设计成可以嵌入到 tremor脚本语言 中用于 提取 操作。

解析器也可以独立使用。这个库测试中解析日志的相当复杂的示例比文字描述更形象。

  let pattern = r#"%{syslog_timestamp} %{syslog_hostname} %{?syslog_prog}: %{syslog_program_aux}[%{syslog_pid:int}] %{request_unix_time} %{request_timestamp} %{request_elapsed_time} %{server_addr}:%{server_port:int} %{remote_addr}:%{remote_port:int} "%{response_content_type}" %{response_content_length} %{request_status} %{bytes_sent} %{request_length} "%{url_scheme}" "%{http_host}" "%{request_method} %{request_url} %{request_protocol}" "%{http_referer}" "%{http_user_agent}" "%{http_x_forwarded_for}" "%{http_ttrue_client_ip}" "%{remote_user}" "%{is_bot}" "%{admin_user}" "%{http_via}" "%{response_location}" "%{set_cookie}" "%{http_cookie}" "%{moawsl_info}" "%{php_message}" "%{akamai_edgescape}" "%{uid_info}" "%{geoip_country}" "%{geoip_region}" "%{geoip_city}" "%{geoip_postal}" "%{geoip_dma}" "%{server_id}" "%{txid}" "%{hpcnt}" "%{client_accept}" "%{client_accept_charset}" "%{client_accept_encoding}" "%{client_accept_language}" "%{client_accept_datetime}" "%{client_pragma}" "%{client_transfer_encoding}" "%{client_attdeviceid}" "%{client_wap_profile}" %{weblog_end}"#;
  let p = lex("%{name}%{_}%{_(|)}%{age}");
  assert!(lex(pattern).is_ok());
  assert!(p.is_ok());

依赖项

~5.5MB
~101K SLoC