우리는 로그 파일에서 많은 양의 텍스트 데이터를 처리하기 위해 Drools를 실험하고 있습니다. 나는 사건 시간을 적절히 측정하는 방법을 이해하려고 노력하고있다.잠꼬대를 사용하여 텍스트 로그 내에서 이벤트 지속 시간을 계산하십시오.
이벤트는 하나의 로그 라인에서 시작하지만 성공적으로 완료되거나 비정상적으로 중단 될 수 있습니다. 그게 제가 캡쳐하는데 문제가 있습니다. 여기에 (다른 로그 라인을 필터링하는 경우) 로그 항목이 보일 수 있습니다 방법은 다음과 같습니다
Jan 24 06:50:29 app[623]: CallOriginateCmd
Jan 24 07:19:27 app[616]: Client ended the call
Jan 24 09:00:18 app[623]: CallOriginateCmd
Jan 24 09:34:48 app[616]: Client ended the call
Jan 24 11:03:56 app[623]: CallOriginateCmd
Jan 24 12:56:58 app[616]: Client ended the call
Jan 24 15:48:11 app[623]: CallOriginateCmd
Jan 24 16:13:24 app[616]: Client ended the call
Jan 24 17:16:16 app[623]: CallOriginateCmd
Jan 24 18:48:51 app[616]: Client ended the call
Jan 25 06:09:01 app[623]: CallOriginateCmd
Jan 25 06:09:24 app[623]: Failure: timeout sending Config
Jan 25 06:09:26 app[623]: CallOriginateCmd
Jan 25 06:09:50 app[623]: Failure: timeout sending Config
내가 24 6시 50분 29초 호출 7시 19분 27초과 1 월을 연결하는 규칙을 만들려고 해요 종료, 1 월 25 일 06:09:01 호출 (06:09:24 실패 등) 아래의 규칙은 내가 원하는 오른쪽 시작/종료 시간을 가진 Call() 객체를 만들지 않습니다. 위에서
rule "Found Call Start"
when
LogEntry(message matches ".*CallOriginateCmd.*", logTimestamp : timestamp)
then
Call call = new Call();
call.setStarttime(logTimestamp);
call.setPartial (true);
insert(call);
AnalysisLog.debug(logTimestamp, "Call Started");
end
rule "Found Call End"
when
LogEntry(message matches ".*Client ended the call.*", logTimestamp : timestamp)
call : Call(partial == true)
then
call.setEndtime(logTimestamp);
call.setPartial(false);
call.setFailure(false);
update(call);
AnalysisLog.debug(logTimestamp, "Call Ended.");
end
rule "Found Call Failure"
when
LogEntry(message matches ".*timeout sending Config.*", logTimestamp : timestamp)
call : Call(partial == true)
then
call.setEndtime(logTimestamp);
call.setPartial(false);
call.setFailure(true);
update(call);
AnalysisLog.debug(logTimestamp, "Call Failed.");
end
출력은 다음과 같습니다 :
Jan 17 22:53:04: Call Started
Jan 18 02:10:23: Call Failed.
Jan 17 23:09:23: Call Started
Jan 18 02:10:23: Call Failed.
Jan 17 23:25:39: Call Started
모든 호출은 로그의 마지막 호출이 일치해야하지만, 실패 일치하는 것으로 보인다
여기 내 코드의 개요입니다. 내
call : Call(partial == true)
절이 시작 + 끝을 연결하거나 함께 중지 + 시작하지만 것 "때"이 분명히이 작업을 수행하지 않습니다
는 그 코드를 생각했다.대신 "when"절에서 logTimestamp가 호출 시작 시간과 가장 가까운 호출을 찾는 방법을 찾아야한다고 가정합니다. 이것이 가능한가? TIA
감사합니다. LogEntry를 when 절에 모두 추가 할 생각은 없었습니다. –