lib/cfe_internal_hub.cf

Table of Contents

cfe_internal_database_cleanup_diagnostics

Prototype: cfe_internal_database_cleanup_diagnostics(settings)

Arguments:

  • settings of vars promiser index of vars promiser remove_query_$(settings[$(index)][report]) of commands promiser $(sys.bindir)/psql cfdb -c "$(remove_query_$(settings[$(index)][report]))"

Implementation:

bundle agent cfe_internal_database_cleanup_diagnostics (settings)
{
  vars:
      "index" slist => getindices("settings");

      "remove_query_$(settings[$(index)][report])"
      string => "DELETE FROM $(settings[$(index)][table]) WHERE $(settings[$(index)][time_key]) < (CURRENT_TIMESTAMP - INTERVAL '$(settings[$(index)][history_length_days]) day');";

  commands:
      "$(sys.bindir)/psql cfdb -c \"$(remove_query_$(settings[$(index)][report]))\""
      handle => "cf_database_maintain_diagnostics_$(settings[$(index)][report])";
}