ilogtail
ilogtail copied to clipboard
[QUESTION]:如何将日志输出到victorialogs
victorialogs官方filebeat配置
filebeat.autodiscover:
providers:
- type: docker
hints.enabled: true
processors:
- add_docker_metadata: ~
output.elasticsearch:
hosts: [ "http://victorialogs:9428/insert/elasticsearch/" ]
worker: 5
parameters:
_msg_field: "message"
_time_field: "@timestamp"
_stream_fields: "container.name"
http:
enabled: true
host: 0.0.0.0
port: 5066
我使用ilogtail配置
enable: true
inputs:
- Type: input_file
FilePaths:
- /var/log/*/*.log
flushers:
- Type: flusher_elasticsearch
Addresses:
- "http://victorialogs:9428/insert/elasticsearch/"
#Index: default
#Authentication:
# PlainText:
# Username: user
# Password: 123456
HTTPConfig:
MaxIdleConnsPerHost: 10
ResponseHeaderTimeout: Second
- Type: flusher_stdout
无法输出日志到victorialogs
@ktpktr0 根据victorialogs官方文档描述,_msg变量必须存在。你可能需要在URL中添加_msg_feild参数指定_msg。 我使用下列配置可以将日志输出到victorialogs
enable: true inputs: - Type: service_docker_stdout Stderr: true Stdout: true processors: - Type: processor_json SourceKey: content KeepSource: true ExpandDepth: 1 ExpandConnector: "" KeepSourceIfParseError: true flushers: - Type: flusher_http RemoteURL: http://localhost:9428/insert/jsonline?_time_field=_time_&_msg_field=content QueueCapacity: 16 Convert: Protocol: jsonline Encoding: json