ML-log-detection
ML-log-detection은 Kafka 로그 스트림을 받아 컨테이너 단위로 버퍼링하고, TFLite 추론으로 이상 여부를 판단하는 파이프라인입니다.
확인된 구성
kafka_anomaly_detection.py는KafkaConsumer와KafkaProducer를 함께 사용합니다.- 추론은
tflite_runtime.interpreter로 수행하며, 모델 경로는./models/anomaly_detection_classifier.tflite입니다. - 전처리기는
./preprocessors/onehot_encoder.pkl,ordinal_encoder.pkl,scaler.pkl을joblib으로 불러옵니다. - 로그는
container_logs에 컨테이너별로 쌓이고,ThreadPoolExecutor(max_workers=20)와 주기 스레드로 30초 단위 분석을 실행합니다. - 알림 토픽은
MLP_detection입니다. script/train_classifier.py는 TensorFlow Keras로 이진 분류기를 학습하고,.h5모델과 학습 곡선 이미지를 저장합니다.script/preprocess.py는data/cryptominer,data/spring4shell,data/flask_ssti의 CSV를 읽어 레이블을 붙이고, 인코더와 스케일러를 학습한 뒤processed_data.csv와preprocessors/*.pkl을 저장합니다.
모델/데이터
- 학습 모델 파일은
models/anomaly_detection_classifier.h5와models/anomaly_detection_classifier.tflite가 함께 존재합니다. - 전처리 산출물은
preprocessors디렉터리에 분리되어 있습니다. - README에는
docker build -t kafka-anomaly-detection .한 줄만 남아 있습니다.