Coder Social home page Coder Social logo

ft-tree's Introduction

Paper

Our paper is published on IEEE/ACM International Symposium on Quality of Service. The information can be found here:

  • Title: Syslog Processing for Switch Failure Diagnosis and Prediction in Datacenter Networks
  • Authors: Shenglin Zhang, Weibin Meng, Jiahao Bu, Sen Yang, Ying Liu, Dan Pei, Jun(Jim) Xu, Yu Chen, Hui Dong, Xianping Qu, Lei Song
  • Paper link: paper

环境:

python3, pygraphviz

训练&匹配日志整合:

  • 运行命令:python main_train.py -train_log_path training.log -out_seq_path output.seq -templates output.template
    • 参数解释:
      • -train_log_path: 训练所需要的原始日志
      • -out_seq_path:日志匹配完之后的编号序列
      • -templates:输出的模板文件
    • 注意:使用该算法时,最好将数据集中前面几列时间、消息类型的信息删掉,要不然比较乱

每个文件的作用

训练日志模板:

  • 输出文件:模板、单词词频列表
    • 运行脚本的的命令:
      • python ft_tree.py -FIRST_COL 0 -NO_CUTTING 1 -CUTTING_PERCENT 0.3 -data_path ./training.log -template_path ./output.template -fre_word_path ./output.fre -picture_path ./tree.png -leaf_num 4 -short_threshold 5 -plot_flag 1
    • 参数样例:
      • FIRST_COL 每行日志从第几列作为输入,默认为0
      • NO_CUTTING = 0 #初步设定1时,是前30% 不剪枝 ,全局开关, 当其为0时,全局按照min_threshold剪枝
      • CUTTING_PERCENT =0.6 #前百分之多少是不剪枝的
      • train_log_path='input.txt'
      • template_path = "./logTemplate.txt" #模板
      • fre_word_path = "./fre_word.txt" #
      • leaf_num = 4 #剪枝数
      • picture_path = './tree.png'
      • short_threshold = 2 #过滤掉长度小于5的日志
      • plot_flag 默认为0,不画图,若为1,则将ft_tree画出来,会同时画出“短模板”(蓝色)和“剪枝结点”(红色)

匹配ft-tree的日志模板:

  • 运行脚本的的命令:

    • python3 matchTemplate.py -short_threshold 5 -leaf_num 6 -template_path ./output.template -fre_word_path ./output.fre -log_path ./training.log -out_seq_path ./output.seq -plot_flag 0 -CUTTING_PERCENT 0.3 -NO_CUTTING 1 -match_model 1
  • 参数样例:

    • short_threshold = 2 #过滤掉长度小于5的日志
    • leaf_num 增量学习时的剪枝阈值。(如果将6改成10,可以通过样例数据看出不同匹配机制中的不同效果,即LearnTemplateByIntervals会对新来的数据做剪枝)
    • template_path = './output.template'
    • fre_word_path = './output.fre'
    • runtime_log_path = './new.log'
    • out_seq_path = './output.seq'
    • plot_flag 0为不画图,1为画图,默认为0。(如树太大不要画图,会卡死)
    • CUTTING_PERCENT 指定每条日志的前百分之几的单词不剪枝,增量学习时会用到,正常匹配用不到
    • NO_CUTTING 是否每条日志的前几个单词不剪枝,0为正常剪枝,1为不剪枝,默认为1。增量学习时会用到,正常匹配用不到
    • match_model 1:正常匹配日志 2:单条增量学习&匹配 3:批量增量学习&匹配
  • 增量学习模板:

    • matchLogsAndLearnTemplateOneByOne()函数 单条匹配,如果匹配不到,则学习新的模板。会将新学到的模板插入到模板文件的最后。
    • matchLogsFromFile() 函数,正常匹配日志,如果匹配不到,则为模板序号为0
    • LearnTemplateByIntervals()函数, 将一时段的日志作为输入,基于以前的模板增量学习,新添加的日志模板也会按照设定的阈值剪枝,最终将新学到的模板插入到模板文件的最后。 例如在样例数据中,假设新来的日志为newlogs.dat, 原始的模板树为Trace_train.png,当剪枝k=6时(如图reBuildTree_k6),会剪枝,当阈值为10时(如图reBuildTree_k10),会保留一些变量

日志模板按照原始日志单词顺序排序:

将模板中的单词按照原日志中的单词顺序排列,得到正序模板

  • 运行脚本的的命令:
    • python3 orderWords.py -templates ./output.template -sequences ./output.seq -rawlog ./training.log -order_templates ./output.template_order

按照正序模板匹配日志:

按照日志原先的单词顺序匹配

  • 运行脚本的的命令:
    • python3 matchTemplate.py -short_threshold 5 -leaf_num 6 -template_path ./output.template_order -log_path ./training.log -out_seq_path ./output2.seq -plot_flag 1 -CUTTING_PERCENT 0.3 -NO_CUTTING 1 -match_model 4

splitTimeWindows.py:

模板分析:切分时间窗口,然后统计正常时段、异常时段、全部时段中出现top10的模板,并且画图

countFreTemplates.py:

模板分析:输出前10个常出现的模板,以及每个模板对应的日志

ft-tree's People

Contributors

weibinmeng avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.