andrewkroh / terraform-module-fleet

Terraform module for managing Elastic Fleet agent policies.
Apache License 2.0
3 stars 2 forks source link

Unable to set data_stream.dataset in sql input module #26

Closed mholttech closed 1 year ago

mholttech commented 1 year ago

I'm generating module for https://github.com/elastic/integrations/tree/main/packages/sql_input but it is not exposing the data_stream.dataset variable.

andrewkroh commented 1 year ago

That appears to be an undocumented variable that is not declared within the package's manifest (https://github.com/elastic/package-spec/issues/656). Seems like it's a feature of input packages that is not documented by the elastic/package-spec. We'll have into inject that variable in as a policy template variable.

POST kbn:/api/fleet/package_policies
{
  "policy_id": "<agent_policy_id>",
  "package": {
    "name": "sql",
    "version": "0.4.0"
  },
  "name": "sql-1",
  "description": "",
  "namespace": "default",
  "inputs": {
    "sql-sql/metrics": {
      "enabled": true,
      "streams": {
        "sql.sql": {
          "enabled": true,
          "vars": {
            "hosts": [
              "root:test@tcp(127.0.0.1:3306)/"
            ],
            "period": "10s",
            "driver": "mysql",
            "sql_queries": "- query: SHOW GLOBAL STATUS LIKE 'Innodb_system%'\n  response_format: variables\n        \n",
            "merge_results": false,
            "data_stream.dataset": "sql"
          }
        }
      }
    }
  }
}
Screenshot 2023-10-31 at 15 51 42
andrewkroh commented 1 year ago

PTAL at #27

mholttech commented 1 year ago

Thanks Andrew! I'm checking it out now and will report back shorly