我已经在AWS中设置了Opensearch。我已经在Ubuntu 18.04中安装了td-agent
。下面是我的td-agent.conf
文件:
<source>
@type tail
path /home/rocket/PycharmProjects/EFK/log.json
pos_file /home/rocket/PycharmProjects/EFK/log.json.pos
format json
time_format %Y-%m-%d %H:%M:%S
tag log
</source>
<match *log*>
@type opensearch
host search-tanz-domain-2vbjmk2d4.us-west-2.es.amazonaws.com/
port 9200
scheme https
ssl_verify false
user admin
password lah_001
index_name test
</match>
运行td-agent
时,我收到以下错误:2023-01-26 15:41:44 +0000 [warn]: #0 Could not communicate to OpenSearch, resetting connection and trying again. [404] {"error":{"root_cause":[{"type":"index_not_found_exception","reason":"no such index [:9200]","index":":9200","resource.id":":9200","resource.type":"index_or_alias","index_uuid":"_na_"}],"type":"index_not_found_exception","reason":"no such index [:9200]","index":":9200","resource.id":":9200","resource.type":"index_or_alias","index_uuid":"_na_"},"status":404}
所以它说index not found
这是一个有点奇怪,因为根据我的理解,当你发送数据到Opensearch或Elasticsearch,然后你需要创建索引模式手动使用Kibana.我从来没有遇到过这个错误的Elasticsearch,我只是在Opensearch面临这个问题,而他们两个看起来是一样的.
编辑
我已经使用API创建了索引:
我列出了所有的索引,我可以看到test
:
现在我再次开始使用td-agent
上传数据,但仍然得到与上面相同的错误。
1条答案
按热度按时间1u4esq0p1#
我以前没有使用过
td-agent
,但根据您提供的配置文件,它似乎试图达到索引test
。在
opensearch
中,当您创建域时,它不包含任何索引。当你发送数据到opensearch或elasticsearch然后你需要到创建索引模式手动通过使用kibana
我觉得不一定,你可以不用
kibana
创建索引,也可以不用发送数据创建索引,其实我觉得先创建索引,后发送数据是比较好的做法。我认为如果你先创建索引
test
,它应该对你有用。在Java中:
参见:Sample code for Amazon OpenSearch Service