在这个系统上,我有calyptia-fluentd,并且我正在尝试开发一个自定义过滤器插件。
首先,我使用一些初始代码创建了一个 gem,并且安装了这个 gem,并使用该插件创建了一个配置文件。
但是,calyptia-fluentd从命令行启动(环境是安装程序提供的环境,而不是通用的 Windows 命令提示符)会出现以下情况:
C:\opt\calyptia-fluentd>calyptia-fluentd -vv
2022-08-11 16:24:23 +0200 [info]: fluent/log.rb:330:info: parsing config file is succeeded path="C:\\opt\\calyptia-fluentd\\bin\\\\..\\etc\\calyptia-fluentd\\calyptia-fluentd.conf"
2022-08-11 16:24:23 +0200 [info]: fluent/log.rb:330:info: gem 'fluentd' version '1.15.0'
2022-08-11 16:24:23 +0200 [info]: fluent/log.rb:330:info: gem 'fluent-plugin-calyptia-monitoring' version '0.1.3'
...
2022-08-11 16:24:23 +0200 [info]: fluent/log.rb:330:info: gem 'fluent-plugin-custom' version '0.0.3'
...
2022-08-11 16:24:23 +0200 [info]: fluent/log.rb:330:info: gem 'fluent-plugin-windows-eventlog' version '0.8.1'
2022-08-11 16:24:23 +0200 [error]: fluent/log.rb:372:error: config error file="C:\\opt\\calyptia-fluentd\\bin\\\\..\\etc\\calyptia-fluentd\\calyptia-fluentd.conf" error_class=Fluent::NotFoundPluginError error="Unknown filter plugin 'filter_custom'. Run 'gem search -rd fluent-plugin' …Run Code Online (Sandbox Code Playgroud) 我有一台带有Cassandra 3.9和2桌子的开发机器,一台有~~ 400,000条记录,另一条有大约40,000,000条记录.他们的结构不同.
他们每个都在字段x上有一个二级索引,我正在尝试运行表单的查询SELECT MAX(x) FROM table.在第一个表上,查询需要几秒钟,而在第二个表上,它会超时.
我的经验是关系数据库,这些查询是微不足道和快速的.所以在Cassandra中,看起来索引不用于执行这些查询?还有其他选择吗?
我在寻找一种不涉及引入一个额外的“通用”字段的溶液等Value,Data等这将是该变种领域的占位符。
我有一个 JSON 规范,它描述了几个大型结构,其中大部分包含简单的值,但偶尔也会包含一个结构本身的值,其动态类型取决于某个字段的值。
例如,这两个 JSON 文档都应该解组为同一个 Go 结构:
{
"some_data": "foo",
"dynamic_field": { "type": "A", "name": "Johnny" },
"other_data": "bar"
}
Run Code Online (Sandbox Code Playgroud)
和
{
"some_data": "foo",
"dynamic_field": { "type": "B", "address": "Somewhere" },
"other_data": "bar"
}
Run Code Online (Sandbox Code Playgroud)
JSON 结构已设置,我无法更改它。
Go 结构体必须如下所示:
type BigStruct struct {
SomeData string `json:"some_data"`
DynamicField Something `json:"dynamic_field"`
OtherData string `json:"other_data"`
}
Run Code Online (Sandbox Code Playgroud)
问题是如何真正做到这一点以及那种Something类型应该是什么。
我已经开始使它成为一个界面:
type Something interface {
GetType() string
}
Run Code Online (Sandbox Code Playgroud)
并有几个结构体和函数与之配合:
type BaseDynamicType struct {
Type string `json:"type"`
}
type DynamicTypeA …Run Code Online (Sandbox Code Playgroud)