Logstash 파이프 라인에서 다른 유형의 입력을 분리하려면 식별을 위해 type
필드와 tags
필드를 사용하십시오.
Filebeat 구성에서 각기 다른 데이터 형식에 대해 다른 광도계를 사용해야하며 각 광도계에 다른 document_type:
필드가 설정 될 수 있습니다. 예를 들어
Reference
: 다른 광부가 document_type: log_message
있는 동안 상기 예에서
filebeat:
# List of prospectors to fetch data.
prospectors:
# Each - is a prospector. Below are the prospector specific configurations
-
# Paths that should be crawled and fetched. Glob based paths.
# For each file found under this path, a harvester is started.
paths:
- "/var/log/apache/httpd-*.log"
# Type to be published in the 'type' field. For Elasticsearch output,
# the type defines the document type these entries should be stored
# in. Default: log
document_type: apache
-
paths:
- /var/log/messages
- "/var/log/*.log"
document_type: log_message
는 /var/log/apache/httpd-*.log
의 로그는 document_type: apache
있을 것이다.
이 document-type
필드는 Logstash가 이벤트를 처리 할 때 type
필드가됩니다. 그런 다음 Logstash에서 if
문을 사용하여 다른 유형에 대해 다른 처리를 수행 할 수 있습니다. 예를 들어
Reference
: 귀하의 질문에 "데이터 형식"코덱 인 경우
filter {
if [type] == "apache" {
# apache specific processing
}
else if [type] == "log_message" {
# log_message processing
}
}
하지만 syslog 형식의 일부 메시지와 json의 다른 메시지는 어떻게됩니까? "코덱"을 logstash의 "output"에 지정해야합니까? –
나는 filebeat에서 오는 것들을 logstash로 가져옵니다. –
코덱은 logstash elasticsearch 출력 –