日志异常检测,Used for log anomaly detection, including log preprocessing, training, prediction, and output results.
This work is developed on the basis of https://github.com/d0ng1ee/logdeep, and use Drain for log parsing.
- Used for producing environment.
- Including complete process.
- Outputing anomaly logs, rather than precision, recall, F1-score and so on.
- python>=3.6
- pytorch >= 1.1.0
-
Preprocess logs
cd demo python preprocess.pyThen you will get the parsed log file at
../result/parse_result, andlength of event_id_maprepresents the count of log templates,../data/demo_input.csvis the file where the EventId has been mapped to numbers starting from 1 -
Train model
python deeplog.py trainIt will tain using
../data/demo_input.csvand the result, key parameters and train logs will be saved underresult/deeplogpath -
Predict and output anomaly result
python deeplog.py predictIt will predict using
name = 'demo_input.csv'inpredict.py, here I am using the same file for training, validation, and prediction. But you can change it as needed.😁
The anomaly output will be saved as../result/anomaly_output_for_xxx.csv. -
DIY your own model
Just try to modify parameters likewindow_size,num_candidates,inputfileto build your own model.😇
If you have any questions, please open an issue.
Welcome to pull requests to improve this repo!