![유창한 구성이 작동하지 않습니다](https://rvso.com/image/632765/%EC%9C%A0%EC%B0%BD%ED%95%9C%20%EA%B5%AC%EC%84%B1%EC%9D%B4%20%EC%9E%91%EB%8F%99%ED%95%98%EC%A7%80%20%EC%95%8A%EC%8A%B5%EB%8B%88%EB%8B%A4.png)
나는 nginx를 사용하여 elasticsearch와 Kibana를 유창하게 설정했습니다. 지시에 따라 http://192.168.10.25:8888로 이동하면 다음 메시지가 나타납니다.
400 잘못된 요청 'json' 또는 'msgpack' 매개변수가 필요합니다.
아래는 내 fluent.conf입니다.
## 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>
답변1
Fluentd 구성이 작동 중입니다.
in_http에서 HTTP 요청(POST 또는 GET)에 json/msgpack 매개변수가 없음을 확인하기 때문에 "400 잘못된 요청 'json' 또는 'msgpack' 매개변수가 필요합니다."라는 메시지가 나타납니다.
해보세요
curl -X POST -d 'json={"message":"hello"}'
같은 오류가 계속 나타나는지 확인하세요.
답변2
나는 당신이보고 한 것과 똑같은 문제가 있었고, 다음을 사용해 보았습니다.HTTPIE대신에 curl
. 덤프에서 볼 수 있듯이 성공했습니다.
> 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