2016-09-16 1 views
0

당신의 도움이 필요합니다. elasticsearch 클러스터에 내 로그를 보내려면 tail 모드에서 fluentd을 구성해야합니다. 각 로그 라인을 구문 분석하기 위해 regex을 사용하고 있지만 일부 필드의 경우 metricValueinteger으로 변환해야합니다. 나는 몇 가지 시도했지만 작동하지 않습니다. 여기 fluentd 필드를 정수로 변환하십시오.

내 Fluentd에 conf의 파일입니다

<source> 
    @type tail 
    path /tmp/application.log 
    pos_file /tmp/access.log.pos 
    format multi_format 
    tag first.log 

    <pattern> 
     format /(?<app>.*)\((?<instance>.*)\) CID\((?<correlationId>.*)\) (?<level>.*) \[(?<timestamp>.*)\] \[(?<Thread>.*)\] (?<class>.*) - \[Provider:(?<providerName>.*),Curef:(?<cuRef>.*),Operation:(?<operation>.*),Reference:(?<reference>.*),Idx:(?<idx>.*)\]/ 
    </pattern> 
    <pattern> 
     format /(?<app>.*)\((?<instance>.*)\) CID\((?<correlationId>.*)\) (?<level>.*) \[(?<timestamp>.*)\] \[(?<Thread>.*)\] (?<class>.*) - (?<body>.*)/ 
    </pattern> 
    </source> 
    <match *.log> 
    @type copy 
    <store> 
     @type stdout 
    </store> 
    <store> 
     @type elasticsearch 
     host localhost 
     port 9200 
     logstash_format true 
     logstash_prefix fluentd-log 
     flush_interval 10s 
    </store> 
    </match> 

내가 fluend 문서 구문에서 찾을 수 있지만 작동하지 않습니다 (그리고 나는이 줄을 추가 할 위치를 모르는)

types <field_name_1>:<type_name_1>,<field_name_2>:<type_name_2>,... 

elasticsearch으로 보내기 전에 metricValue 필드를 정수로 변환하고 싶습니다.

아무쪼록 감사드립니다.

C.C.

답변

1

케이스의 source 섹션에이 필드 (types <field_name_1>:<type_name_1>,<field_name_2>:<type_name_2>,...)를 입력해야합니다. parser 플러그인을 사용하는 경우 filter 섹션에 삽입해야합니다 (여기는 example입니다).