1 Star 0 Fork 17

Yang_X_Y / rsyslog

forked from src-anolis-os / rsyslog 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
rsyslog-8.2102.0-rhbz2192955-es-5.patch 1.64 KB
一键复制 编辑 原始数据 按行查看 历史
Zhao Hang 提交于 2023-12-05 16:30 . update to rsyslog-8.2102.0-15.src.rpm
diff --git a/plugins/omelasticsearch/omelasticsearch.c b/plugins/omelasticsearch/omelasticsearch.c
index 76d5081d3b..f481ec3f7e 100644
--- a/plugins/omelasticsearch/omelasticsearch.c
+++ b/plugins/omelasticsearch/omelasticsearch.c
@@ -620,6 +620,8 @@ setPostURL(wrkrInstanceData_t *const pWrkrData, uchar **const tpls)
uchar *parent;
uchar *bulkId;
char* baseUrl;
+ /* since 7.0, the API always requires /idx/_doc, so use that if searchType is not explicitly set */
+ uchar* actualSearchType = (uchar*)"_doc";
es_str_t *url;
int r;
DEFiRet;
@@ -645,11 +647,12 @@ setPostURL(wrkrInstanceData_t *const pWrkrData, uchar **const tpls)
if(searchIndex != NULL) {
r = es_addBuf(&url, (char*)searchIndex, ustrlen(searchIndex));
if(r == 0) r = es_addChar(&url, '/');
- if(searchType != NULL) {
- if(r == 0) r = es_addBuf(&url, (char*)searchType, ustrlen(searchType));
- }
- } else
- r = 0;
+
+ if(searchType != NULL) {
+ actualSearchType = searchType;
+ }
+ if(r == 0) r = es_addChar(&url, '/');
+ if(r == 0) r = es_addBuf(&url, (char*)actualSearchType, ustrlen(actualSearchType));
if(pipelineName != NULL && (!pData->skipPipelineIfEmpty || pipelineName[0] != '\0')) {
if(r == 0) r = es_addChar(&url, separator);
if(r == 0) r = es_addBuf(&url, "pipeline=", sizeof("pipeline=")-1);
@@ -693,7 +696,7 @@ computeMessageSize(const wrkrInstanceData_t *const pWrkrData,
const uchar *const message,
uchar **const tpls)
{
- size_t r = sizeof(META_TYPE)-1 + sizeof(META_END)-1 + sizeof("\n")-1;
+ size_t r = sizeof(META_END)-1 + sizeof("\n")-1;
if (pWrkrData->pData->writeOperation == ES_WRITE_CREATE)
r += sizeof(META_STRT_CREATE)-1;
else
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/Yang_X_Y/rsyslog.git
git@gitee.com:Yang_X_Y/rsyslog.git
Yang_X_Y
rsyslog
rsyslog
a8

搜索帮助

344bd9b3 5694891 D2dac590 5694891