title: How deleting old indices after x days for multiple indices pattern elasticsearch?
body: <p>I am using Elasticsearch for storing microservices logs.
  All microservices log in common patterns and by Fluentd logs collected and shipped to index name pattern like <code>log-${serviceName}-%Y.%m.%d</code>.</p>
  <p>I defined an index template for log-<em>-</em> and create an ILM policy to rollover indices to the delete phase after 2 days and delete them after 4 days. and connect the ILM policy to the index-template with <code>my-log-alias</code>.</p>
  <p>So I need something like this:
  <code>each day, there are for example 10 active indices that log documents written to them. and after 2 days these indices all go to the delete phase.</code></p>
  <ol>
  <li>Can I use one index template and one ILM policy for all of my services?</li>
  <li>And What's wrong with my setting on elasticsearch index-template and policy?</li>
  <li>Am I using this feature in the right way?</li>
  </ol>
  <p>Thank you for reading.</p>
  <p>index-template:</p>
  <pre><code>{
    &quot;order&quot;: 0,
    &quot;index_patterns&quot;: [
      &quot;log-*-*&quot;
    ],
    &quot;settings&quot;: {
      &quot;index&quot;: {
        &quot;lifecycle&quot;: {
          &quot;name&quot;: &quot;my-log&quot;,
          &quot;rollover_alias&quot;: &quot;my-log-alias&quot;
        },
        &quot;number_of_replicas&quot;: &quot;1&quot;
      }
    },
    &quot;aliases&quot;: {
      &quot;sb-log&quot;: {}
    },
    &quot;mappings&quot;: {
      &quot;_doc&quot;: {
        &quot;properties&quot;: {
          &quot;level&quot;: {
            &quot;ignore_above&quot;: 256,
            &quot;type&quot;: &quot;keyword&quot;
          },
          &quot;message&quot;: {
            &quot;type&quot;: &quot;text&quot;
          }
        }
      }
    }
  }
  </code></pre>
  <p>ilm-policy</p>
  <pre><code>{
    &quot;policy&quot;: {
      &quot;phases&quot;: {
        &quot;hot&quot;: {
          &quot;min_age&quot;: &quot;0ms&quot;,
          &quot;actions&quot;: {
            &quot;rollover&quot;: {
              &quot;max_age&quot;: &quot;2d&quot;,
              &quot;max_size&quot;: &quot;50gb&quot;
            },
            &quot;set_priority&quot;: {
              &quot;priority&quot;: 100
            }
          }
        },
        &quot;delete&quot;: {
          &quot;min_age&quot;: &quot;4d&quot;,
          &quot;actions&quot;: {
            &quot;delete&quot;: {
              &quot;delete_searchable_snapshot&quot;: true
            }
          }
        }
      }
    }
  }
  </code></pre>