로그파일 분석 스크립트 작성 좀 도와주세요..
글쓴이: kyeongchan / 작성시간: 목, 2005/12/08 - 3:53오후
로그파일을 분석해서 통계를 내려고 합니다.
로그파일 형태는
시:분:초 {INSERT|UPDATE} 입니다.
ex)
00:00:00 INSERT
00:00:01 UPDATE
00:00:01 INSERT
00:00:01 UPDATE
.
.
.
13:00:04 INSERT
13:05:04 INSERT
.
.
23:59:59 UPDATE
제가 뽑고 싶은 형태는
시간별 INSERT, UPDATE 개수입니다.
지금까지 한 방법은
시간별로 루프를 돌면서
grep "^시간" 로그명 | grep "INSERT" | wc -l
grep "^시간" 로그명 | grep "UPDATE" | wc -l
이런식이었습니다..
그러다 보니
파일하나 처리하는데 24번 파일을 오픈하는 결과가 나오더라구요..
이걸 파일 한번 쭉 읽어내려가면서 처리하고 끝내는 효율적인 방법을 고민하고 있습니다...
감사합니다..
Forums:
php 로 짜 봤습니다.[code:1]<?$fp
php 로 짜 봤습니다.
---------
간디가 말한 우리를 파괴시키는 7가지 요소
첫째, 노동 없는 부(富)/둘째, 양심 없는 쾌락
셋째, 인격 없는 지! 식/넷째, 윤리 없는 비지니스
이익추구를 위해서라면..
다섯째, 인성(人性)없는 과학
여섯째, 희생 없는 종교/일곱째, 신념 없는 정치
고맙습니다만... PHP 를 사용할 수 없는 환경이 되어서요..-.-
답변 잘 보았습니다..
PHP 말고 단순 SHELL 로는 안될까요..
환경이 지원을 안하네요...
[code:1]awk '/^시간/{if($2=="
awk '/^시간/{if($2=="UPDATE"){u++}if($2=="INSERT"){i++}};END{print "i:"i " u:"u}' 로그명
----
자신을 이길 수 있는자는
무슨짓이든 할수있다..
즉..무서운 넘이란 말이지 ^-_-^
나? 아직 멀었지 ㅠㅠ
Gema 로 해보면..
로그분석하는 Gema 변환Rule
http://bbs.kldp.org/viewtopic.php?t=57660&highlight=gema
댓글 달기