Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[QUESTION]:如何将日志输出到victorialogs #1365

Open
ktpktr0 opened this issue Feb 20, 2024 · 1 comment
Open

[QUESTION]:如何将日志输出到victorialogs #1365

ktpktr0 opened this issue Feb 20, 2024 · 1 comment
Labels
question Further information is requested

Comments

@ktpktr0
Copy link

ktpktr0 commented Feb 20, 2024

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 ktpktr0 added the question Further information is requested label Feb 20, 2024
@ethan256
Copy link

ethan256 commented Feb 22, 2024

@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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants