2014-10-19 2 views
0

FluentD를 사용하여 이벤트 레코드에 값 배열을 만드는 방법은 무엇입니까?FluentD의 값 배열

로그에서 위도와 경도를 분석했습니다. 이 값을 배열로 변환하는 방법은 무엇입니까?

Ex. 은 내가 위도 = -37.0081와 경도 = 174.792 분석 한

2014-9-23T09:27:28.345 1411464370345 -37.0081,174.792 BBC SEARCH be03debe-b0af-4939-9abc-7c0ad25bb114 DEPARTURE 16 576.00 ROLLBACK

같은 로그가 있습니다. 이렇게 JSON 개체를 구성하는 방법은 무엇입니까?

{location:[-37.0081,174.792]}

어떻게 이벤트 레코드의 데이터 유형에 문자열 값을 구문 분석? 정수/실수/이중처럼

답변

0

유형 매개 변수가 인 작성된 배열 in_tail 플러그인.

types qty:integer,txamount:float,location:array

그러나 배열 요소는 문자열 유형이다.

0

<source> 
    type tail 
    path stackoverflow.log 
    format /^(?<time>[^ ]+) (?<field_1>[^ ]+) (?<array_field>[^ ]+) (?<rest>.+)$/ 
    time_format %Y-%m-%dT%H:%M:%S 
    types array_field:array 
    tag test 
</source> 

<match test> 
    type stdout 
</match> 

그런 다음, 2014-9-23T09:27:28.345 1411464370345 -37.0081,174.792 BBC SEARCH be03debe-b0af-4939-9abc-7c0ad25bb114 DEPARTURE 16 576.00 ROLLBACK를 들어, 당신은 내가 Fluentd에서의 v0.10.51로이 테스트

2014-09-23 09:27:28 +0000 test: {"field_1":"1411464370345","array_field":["-37.0081","174.792"],"rest":"BBC SEARCH be03debe-b0af-4939-9abc-7c0ad25bb114 DEPARTURE 16 576.00 ROLLBACK"} 

표준 출력에 다음과 같은 출력을 볼 수 다음과 같은 구성을 시도하지만, 모두와 함께 작동합니다 최근 버전.