Using ELK to implement visualization by calling MDaemon API interface through Python script | MDaemon Technologies, Ltd.

Using ELK to implement visualization by calling MDaemon API interface through Python script


  • Source

    https://github.com/qiangofking/MDaemon_log_download_with_ELK

    Describe

    • Through the MDaemon email server API(API Version: 25.0.2), log downloads are implemented and linked to ELK visualization display

    Overview

    framework

     

    How to use

    1. Configure config/config.ini
    2. Ensure that the two XML format contents under config are compatible with the currently used MD API interface (e.g. API Version: 25.0.2)
    3. Test 4 core modules, file_2json, file_unzip, fileManager in the 'util' folder, as well as the main.py in root path
    4. Most of the libraries used are basic Python libraries. If there are any missing ones, please install them using methods such as "pip install"
    5. At this point, the deployment of the logdownload section is complete(By default, it is downloaded every 5 minutes. To do so, it should be placed on line 90 of main. py, in seconds)
    6. Next, configure ELK (ElasticSearch/Logstash/Kibana), refer to:https://blog.csdn.net/fu_sheng_q/article/details/135215027
    7. Key step: (The monitoring path of the log, line 3; ES address, line 41)Configure the logstash configuration file to enable it to parse the JSON fields of the downloaded logs and formatted them properly. Please refer to the example template for reference
    8. After completing everything, you will receive an MD+log_rownload+ELK; Have fun!

     

    Tips

    1. I just downed a "routing.log", and others followed the same routine;
    2. Alarm? None; There can also be;
    3. Disposal? None; There can also be;
    4. Equipment linkage? None; There can also be;

     

    Partial Detail Display

    # 核心功能验证:下载密文routing日志(返当日日志文件id号,下载结果)
    python util\fileManager.py



    # 核心功能验证:密文routing日志转明文
    python util\file_2json.py



    # 核心功能验证:明文routing日志转json
    python util\file_2json.py



    # 核心功能验证:整体调用
    python main.py



Please login to reply this topic!