Postgrep: Difference between revisions

From Rixort Wiki
Jump to navigation Jump to search
Created page with "Script for searching through Postfix log files, effectively like exigrep but for Postfix instead of Exim. == Language choice == Use Python for speed of development and cross..."
 
 
(One intermediate revision by the same user not shown)
Line 10: Line 10:
* Automatically decompress .gz files in memory before reading.
* Automatically decompress .gz files in memory before reading.
* Read all data into an SQLite 'in memory' file, which allows fast and detailed filtering.
* Read all data into an SQLite 'in memory' file, which allows fast and detailed filtering.
== Questions ==
* How do we determine the year for each log entry? Could use current year, but what happens if we import logs from December and January?
* How do we identify Postfix log entries?
* Is it more efficient to process files line by line as we read them or slurp the file into a single variable and then iterate over that?


[[Category:Python]]
[[Category:Python]]

Latest revision as of 15:30, 6 February 2019

Script for searching through Postfix log files, effectively like exigrep but for Postfix instead of Exim.

Language choice

Use Python for speed of development and cross-platform code.

Features

  • Specify multiple input files, will all be read and processed.
  • Automatically decompress .gz files in memory before reading.
  • Read all data into an SQLite 'in memory' file, which allows fast and detailed filtering.

Questions

  • How do we determine the year for each log entry? Could use current year, but what happens if we import logs from December and January?
  • How do we identify Postfix log entries?
  • Is it more efficient to process files line by line as we read them or slurp the file into a single variable and then iterate over that?