简体   繁体   中英

Log file parsing using Python

I am trying to parse the log files using python but my question is, how to handle multiple mail servers and their log files, because each mail server will have a different path to its log file and the path might differ from system to system. How to go about in this case ??

Since I am new to Python I am not sure how to parse the log files, can anyone help me with the CODE, to parse the log files and what libraries to use that will make the task of log parsing easier ??

You could use a dictionary with key/value being server/path. Something like this:

log_paths = {'server1.net': '/var/log/myapp/myapp.log', ...}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM