Seaslog SeasLog::analyzerDetail
(PECL seaslog >=1.1.6)
SeasLog::analyzerDetail — Get log detail by level, log_path, key_word, start, limit, order
설명
public static SeasLog::analyzerDetail( string $level, string $log_path = ?, string $key_word = ?, int $start = ?, int $limit = ?, int $order = ? ): mixed
`SeasLog`는 `grep -ai '{level}'의 결과를 얻습니다 | grep -ai '{key_word}' | sed -n '{start},{limit}'p` 시스템 파이프를 사용하고 배열을 PHP로 반환합니다.
매개변수
level
- String. The log information level.
log_path
- String. The log information path.
key_word
- String. The search key word for log information.
start
- Int. Default is `1`.
limit
- Int. Default is `20`.
order
- 국제 기본값은 SEASLOG_DETAIL_ORDER_ASC입니다. 또한 보십시오:
반환 값
결과를 배열로 반환합니다.
메모: `start`,`limit`가 NULL이 아니고 Windows에서 SeasLog는 'Param start and limit don't support Windows'라는 메시지와 함께 예외를 발생시킵니다.
Examples
예제 #1 SeasLog::analyzerDetail() 예제
<?php
$result1 = SeasLog::analyzerDetail(SEASLOG_ERROR);
//with `logger` and `key_word`
$result2 = SeasLog::analyzerDetail(SEASLOG_ERROR,'test/logger/','neeke');
//with `start` and `limit`
$result3 = SeasLog::analyzerDetail(SEASLOG_ERROR,'test/logger/','neeke',1,2);
var_dump($result1,$result2,$result3);
?>
위의 예는 다음과 유사한 결과를 출력합니다.
array(20) { [0]=> string(93) "2018-07-09 12:52:53 | ERROR | 12247 | 5b42ea2580e51 | 1531111973.528 | log message from neeke" [1]=> string(93) "2018-07-09 12:52:54 | ERROR | 12256 | 5b42ea26d6657 | 1531111974.878 | log message from neeke" [2]=> string(93) "2018-07-09 12:52:55 | ERROR | 12265 | 5b42ea277b8d4 | 1531111975.506 | log message from neeke" [3]=> string(104) "2018-07-09 12:52:55 | ERROR | 12274 | 5b42ea27db5dc | 1531111975.898 | log message from the other people" ... } array(3) { [0]=> string(93) "2018-07-09 12:52:53 | ERROR | 12247 | 5b42ea2580e51 | 1531111973.528 | log message from neeke" [1]=> string(93) "2018-07-09 12:52:54 | ERROR | 12256 | 5b42ea26d6657 | 1531111974.878 | log message from neeke" [2]=> string(93) "2018-07-09 12:52:55 | ERROR | 12265 | 5b42ea277b8d4 | 1531111975.506 | log message from neeke" } array(2) { [0]=> string(93) "2018-07-09 12:52:53 | ERROR | 12247 | 5b42ea2580e51 | 1531111973.528 | log message from neeke" [1]=> string(93) "2018-07-09 12:52:54 | ERROR | 12256 | 5b42ea26d6657 | 1531111974.878 | log message from neeke" }
기타
- SeasLog::analyzerCount() - 레벨, log_path 및 key_word별 로그 수 가져오기