타임스탬프 추출 및 차이점 찾기

타임스탬프 추출 및 차이점 찾기

다음과 같은 대규모 로그 세트가 있습니다.

June   5 15:51:56.606  [3997]:   TR#153. State machine - state = CC_STATE_IDLE, event = EVT_ISDN_SETUP
June   5 15:51:56.607  [3997]:   TR#153):  SC registration SUCCESS.
June   5 15:52:00.368  [3997]:   TR#153. DSP:4 Channel:26 Type: Modem State: Data 
June   5 15:52:01.837  [3997]:   TR#153. Receive transaction data: prot 1 data length: 159.-------------------->>
June   5 15:52:02.073  [3997]:   TR#153. Send transaction data: 55 <<-------------------
June   5 15:52:04.361  [3997]:   TR#153):Disconnect initated by 32 process.
June   5 15:52:57.382  [3997]:   TR#153. State machine - state = CC_STATE_IDLE, event = EVT_ISDN_SETUP
June   5 15:52:57.383  [3997]:   TR#153):  SC registration SUCCESS.
June   5 15:53:01.327  [3997]:   TR#153. DSP:4 Channel:26 Type: Modem State: Data 
June   5 15:53:04.291  [3997]:   TR#153. Receive transaction data: prot 1 data length: 347.-------------------->>
June   5 15:53:05.071  [3997]:   TR#153. Send transaction data: 103 <<-------------------
June   5 15:53:06.209  [3997]:   TR#153. Receive transaction data: prot 1 data length: 24.-------------------->>
June   5 15:53:07.239  [3997]:   TR#153):Disconnect initated by 32 process.

"EVT_ISDN_SETUP"과 "Disconnect" 이벤트 간의 시간 차이, 즉 기본적으로 각 트랜잭션의 지속 시간을 찾고 싶습니다. 이렇게 하려면 먼저 해당 행에서 타임스탬프를 추출하고 차이점을 찾아야 합니다. Perl 코드를 사용해 보았습니다.여기한 인스턴스에서 차이점을 찾는 데 효과적입니다. 내 임무는 관심 있는 이벤트의 타임스탬프를 성공적으로 얻은 다음 Perl 코드를 입력하고 TR#ID와 함께 차이를 인쇄하는 것입니다.

나는 무엇을 해야 합니까?

답변1

가정: 패턴을 포함하는 모든 행에는 패턴을 EVT_ISDN_SETUP포함하는 행이 있습니다 . Disconnect알고리즘을 게시하겠습니다.

  Get the time field for the line matching `EVT_ISDN_SETUP` pattern and put it to temp1 file
  Get the time field for the line matching `Disconnect`pattern and put it to another file say temp2.
  Using paste command put the content of both the files to another file say temp3.
  Read every line of the temp3 and pass first & 2nd field your perl script .

관련 정보