보낸 메시지 당 한 줄의 메시지 로그 파일이 있는데 여기에는 분 단위의 시간 소인이 반올림되어 있습니다. Logparser를 사용하여 분당 메시지 빈도에 대한 보고서를 생성하고 동일한 내용을 보여주는 차트를 출력 할 수 있습니다. 여기에 내가 보고서를 생산하기 위해 사용하고 쿼리는 다음과 같습니다소스에 값이없는 시간 간격으로 출력 생성
SELECT
QUANTIZE (Date, 60) AS M,
COUNT(*) AS Total
FROM '[LOGFILEPATH]'
GROUP BY M
ORDER BY M
이 트래픽이을 생성 된 그 분 에 대한 메시지 트래픽 속도를 보여주는 좋은 곳입니다.
그러나 메시지 카운트가 인 분 간격을 보여주는 차트를 출력하고 싶습니다. 막대 차트에서 막대는 해당 분에 대해 0이됩니다. 이렇게하면 메시지 트래픽이없는 간격이 표시됩니다.
당연히 소스 데이터에는 "no message"가 기록되지 않기 때문에 원본 데이터에는 없습니다. 어떤 아이디어가 이것을 어떻게? Logparser인지 여부는 신경 쓰지 않습니다. Powershell은 제가 사용하기에 더 좋은 곳입니다. 심지어 Excel에서도, 수동 개입없이 스크립팅 할 수있는 솔루션을 선호합니다.
우리는 개발자 도구에 대한 접근이 제한적인 Windows 샵이므로 Python, bash 등의 솔루션은 필요하지 않습니다.
여기에는 트래픽이 기록되지 않는 30 분 간격으로 약간의 샘플 (실제, 난독 화 된) 데이터가 있습니다.
SELECT MIN(Date) AS MinDate, MAX(Date) as MaxDate
INTO theDates.csv
FROM yourlog.log
에 포함 된 날짜의 읽기 theDates.csv 사용 :
Date,MID,Host,Sender,Recipient,Subject,Last State
2017-10-26 01:56,1078941,smtp3 (10.0.0.156),[email protected],[email protected],Notification has been created successfully,Message 1078941 to [email protected] received remote SMTP response 'ok'
2017-10-26 01:56,1078938,smtp3 (10.0.0.156),[email protected],[email protected],Notification has been created successfully,Message 1078940 to [email protected] received remote SMTP response '2.0.0'
2017-10-26 01:55,4571113,smtp1 (10.0.1.59),[email protected],[email protected],Notification has been created successfully,Message 4571113 to [email protected] received remote SMTP response '2.0.0'
2017-10-26 01:55,1078936,smtp3 (10.0.0.156),[email protected],[email protected],Notification has been created successfully,Message 1078936 to [email protected] received remote SMTP response 'ok'
2017-10-26 01:54,4571083,smtp1 (10.0.1.59),[email protected],[email protected],Notification has been created successfully,Message 4571083 to [email protected] received remote SMTP response 'Mail accepted'.
2017-10-26 01:53,1078927,smtp3 (10.0.0.156),[email protected],[email protected],Notification has been created successfully,Message 1078927 to [email protected] received remote SMTP response '2.0.0'
2017-10-26 01:52,4571051,smtp1 (10.0.1.59),[email protected],[email protected],Notification has been created successfully,Message 4571051 to [email protected] received remote SMTP response 'ok'
2017-10-26 01:23,4570598,smtp1 (10.0.1.59),[email protected],[email protected],Notification has been created successfully,Message 4570598 to [email protected] received remote SMTP response '2.0.0'
2017-10-26 01:23,4570594,smtp1 (10.0.1.59),[email protected],[email protected],Notification has been created successfully,Message 4570594 to [email protected] received remote SMTP response 'ok'
2017-10-26 01:22,4570579,smtp1 (10.0.1.59),[email protected],[email protected],Notification has been created successfully,Message 4570579 to [email protected] received remote SMTP response '2.0.0'
2017-10-26 01:22,4570577,smtp1 (10.0.1.59),[email protected],[email protected],Notification has been created successfully,Message 4570577 to [email protected] received remote SMTP response '2.0.0'
2017-10-26 01:22,4570575,smtp1 (10.0.1.59),[email protected],[email protected],Notification has been created successfully,Message 4570575 to [email protected] received remote SMTP response '2.0.0'
2017-10-26 01:21,4570571,smtp1 (10.0.1.59),[email protected],[email protected],Notification has been created successfully,Message 4570571 to [email protected] received remote SMTP response 'ok'
2017-10-26 01:21,4570557,smtp1 (10.0.1.59),[email protected],[email protected],Notification has been created successfully,Message 4570557 to [email protected] received remote SMTP response 'OK'
2017-10-26 01:21,4570549,smtp1 (10.0.1.59),[email protected],[email protected],Notification has been created successfully,Message 4570550 to [email protected] received remote SMTP response '2.0.0'
2017-10-26 01:20,1078803,smtp3 (10.0.0.156),[email protected],[email protected],Notification has been created successfully,Message 1078803 to [email protected] received remote SMTP response '2.0.0'
2017-10-26 01:20,1078802,smtp3 (10.0.0.156),[email protected],[email protected],New Account,Message 1078802 to [email protected] received remote SMTP response '2.0.0'
2017-10-26 01:20,4570539,smtp1 (10.0.1.59),[email protected],[email protected],Notification has been created successfully,Message 4570539 to [email protected] received remote SMTP response 'OK'
2017-10-26 01:19,1078794,smtp3 (10.0.0.156),[email protected],[email protected],Notification has been created successfully,Message 1078794 to [email protected] received remote SMTP response 'ok'
예, 정확하게 말하면 찾고있는 기간에는 입력 레코드가 없으므로 실제로는 단일 쿼리로는 불가능합니다. 두 단계 접근법을 사용할 수 있습니다. 첫 번째 단계는 현재 수행하는대로 분 단위로 집계하고 CSV 파일을 생성하는 반면 두 번째 단계는 인위적으로 동일한 형식과 더미 레코드로 생성 된 다른 CSV 파일과 함께 해당 CSV 파일을 쿼리합니다 하루에 1 분마다. 두 분을 모두 쿼리하고 분 단위로 다시 집계하고 더미 항목을 반영하도록 개수를 조정하면 필요한 출력을 얻을 수 있습니다. –