diff --git a/analyzer/storage.go b/analyzer/storage.go index 66f0c8815e..438d34c85e 100644 --- a/analyzer/storage.go +++ b/analyzer/storage.go @@ -81,7 +81,8 @@ func newGraphBackendFromConfig(etcdClient *etcd.Client) (graph.PersistentBackend var mapping map[string]interface{} if useFlattened { mapping = map[string]interface{}{ - "type": "flattened", + "type": "flattened", + "ignore_above": config.GetInt(configPath + ".flattened_ignore_above"), } } else { mapping = map[string]interface{}{ diff --git a/config/config.go b/config/config.go index ba9ff4cd38..172d3c7b9c 100644 --- a/config/config.go +++ b/config/config.go @@ -210,6 +210,7 @@ func init() { cfg.SetDefault("storage.elasticsearch.indices_to_keep", 0) cfg.SetDefault("storage.elasticsearch.index_prefix", "skydive_") cfg.SetDefault("storage.elasticsearch.use_flattened", true) + cfg.SetDefault("storage.elasticsearch.flattened_ignore_above", 32768) cfg.SetDefault("storage.elasticsearch.exclude_from_mapping", []string{ "Metadata.*.Extra", "Metadata.Container.Labels", diff --git a/etc/skydive.yml.default b/etc/skydive.yml.default index e104e89ec2..7ffe6bca2b 100644 --- a/etc/skydive.yml.default +++ b/etc/skydive.yml.default @@ -431,6 +431,12 @@ storage: # - Metadata.OVN.Options # - Metadata.OVN.IPv6RAConfigs + # Use flatten mapping type for fields specified by 'exclude_from_mapping' + # use_flattened: true + + # Ignore flattened fields whose length is above the specified value + # flattened_ignore_above: 32768 + # Snif Nodes Info API to get all the nodes in the cluster # See https://pkg.go.dev/gopkg.in/olivere/elastic.v2?tab=doc#NewClient # Default: false