首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >fluent配置不工作

fluent配置不工作
EN

Server Fault用户
提问于 2014-05-12 15:56:07
回答 2查看 5.9K关注 0票数 3

我已经设置了流利的elasticsearch和Kibana与nginx。我遵循指示,当我转到http://192.168.10.25:8888时,我收到以下消息

400坏请求'json‘或'msgpack’参数是必需的

下面是我的fluent.conf

代码语言:javascript
复制
## built-in TCP input
## $ echo <json> | fluent-cat <tag>
<source>
  type forward
</source>
## built-in UNIX socket input
#<source>
#  type unix
#</source>

# HTTP input
# http://localhost:8888/<tag>?json=<json>
<source>
  type http
  port 8888
  bind 0.0.0.0
  body_size_limit 32m
  keepalive_timeout 10s
</source>

# collect the dmesg output
<source>
  type syslog
  port 42185
  tag system
</source>


# collect tail with: echo '{"event":"event-123","duration":2700}' >> /var/log/example.log
# Fluentd user need read permission on .log and r/w permission on .pos
<source>
  type tail
  path /var/log/example.log
  pos_file /var/log/example.log.pos # to store last read position
  tag personal.example
  format json
</source>
## File input
## read apache logs with tag=apache.access
#<source>
#  type tail
#  format apache
#  path /var/log/httpd-access.log
#  tag apache.access
#</source>

# Listen HTTP for monitoring
# http://localhost:24220/api/plugins
# http://localhost:24220/api/plugins?type=TYPE
# http://localhost:24220/api/plugins?tag=MYTAG
<source>
  type monitor_agent
  port 24220
</source>

# Listen DRb for debug
<source>
  type debug_agent
  port 24230
</source>


## match tag=apache.access and write to file
#<match apache.access>
#  type file
#  path /var/log/fluent/access
#</match>

# events stored on Elastic Search
<match personal.**>
  type elasticsearch
  logstash_format true
  flush_interval 10s # for testing
  include_tag_key true
  tag_key _key
</match>

## match tag=debug.** and dump to console
<match debug.**>
  type stdout
</match>


# match tag=system.** and forward to another fluent server
<match system.**>
  type forward
  <server>
    host 192.168.0.11
  </server>
  <secondary>
<server>
      host 192.168.0.12
    </server>
  </secondary>
</match>

## match tag=myapp.** and forward and write to file
#<match myapp.**>
#  type copy
#  <store>
#    type forward
#    buffer_type file
#    buffer_path /var/log/fluent/myapp-forward
#    retry_limit 50
#    flush_interval 10s
#    <server>
#      host 192.168.0.13
#    </server>
#  </store>
#  <store>
#    type file
#    path /var/log/fluent/myapp
#  </store>
#</match>

## match fluent's internal events
#<match fluent.**>
#  type null
#</match>

## match not matched logs and write to file
#<match **>
#  type file
#  path /var/log/fluent/else
#  compress gz
#</match>
EN

回答 2

Server Fault用户

发布于 2014-05-14 10:09:48

您的Fluentd配置正在工作。

出现消息"400坏请求'json‘或'msgpack’参数是必需的“,因为in_http看到您的HTTP (POST或GET)没有json/msgpack参数。

试着做

代码语言:javascript
复制
curl -X POST -d 'json={"message":"hello"}'

看看你是否继续看到同样的错误。

票数 4
EN

Server Fault用户

发布于 2020-06-09 09:59:36

我遇到了与您报告的问题完全相同的问题,我尝试使用赫特派而不是curl。正如您从转储中看到的,它成功了。

代码语言:javascript
复制
> http --verbose --json POST localhost:8888/tag1.tag2 json={\"foo\":\"bar\"}
POST /ciro.ciro HTTP/1.1
Accept: application/json, */*
Accept-Encoding: gzip, deflate
Connection: keep-alive
Content-Length: 29
Content-Type: application/json
Host: localhost:9880
User-Agent: HTTPie/0.9.9

{
    "json": "{\"foo\":\"bar\"}"
}

HTTP/1.1 200 OK
Connection: Keep-Alive
Content-Length: 0
Content-Type: text/plain
票数 1
EN
页面原文内容由Server Fault提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://serverfault.com/questions/594576

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档