MyNixOS website logo
option

services.amazon-cloudwatch-agent.configuration

Declarations
Type
JSON value
Default
{ }
Example
{
  agent = {
    logfile = "/var/log/amazon-cloudwatch-agent/amazon-cloudwatch-agent.log";
    metrics_collection_interval = 10;
  };
  logs = {
    force_flush_interval = 15;
    log_stream_name = "log_stream_name";
    logs_collected = {
      files = {
        collect_list = [
          {
            file_path = "/var/log/amazon-cloudwatch-agent/amazon-cloudwatch-agent.log";
            log_group_name = "amazon-cloudwatch-agent.log";
            log_stream_name = "{instance_id}";
            timezone = "UTC";
          }
        ];
      };
    };
  };
  metrics = {
    metrics_collected = {
      cpu = {
        append_dimensions = {
          customized_dimension_key_1 = "customized_dimension_value_1";
          customized_dimension_key_2 = "customized_dimension_value_2";
        };
        measurement = [
          {
            name = "cpu_usage_idle";
            rename = "CPU_USAGE_IDLE";
            unit = "Percent";
          }
          {
            name = "cpu_usage_nice";
            unit = "Percent";
          }
          "cpu_usage_guest"
        ];
        metrics_collection_interval = 10;
        resource = [
          "*"
        ];
        totalcpu = false;
      };
    };
    namespace = "MyCustomNamespace";
  };
  traces = {
    traces_collected = {
      oltp = { };
      xray = { };
    };
  };
}