# Add time range filter in this prometheus.yml of metricbeat to get output for a particular time interval

**URL:** <https://discuss.elastic.co/t/add-time-range-filter-in-this-prometheus-yml-of-metricbeat-to-get-output-for-a-particular-time-interval/294822>\
**Category:** Beats\
**Tags:** metricbeat\
**Created:** [January 19, 2022, 1:46pm UTC](https://discuss.elastic.co/t/add-time-range-filter-in-this-prometheus-yml-of-metricbeat-to-get-output-for-a-particular-time-interval/294822 "2022-01-19T13:46:38Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![tweet2santosh86](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/tweet2santosh86/32/100531_2.png) [@tweet2santosh86](https://discuss.elastic.co/u/tweet2santosh86)\
**Post date:** [January 19, 2022, 1:46pm UTC](https://discuss.elastic.co/t/add-time-range-filter-in-this-prometheus-yml-of-metricbeat-to-get-output-for-a-particular-time-interval/294822/1 "2022-01-19T13:46:38Z")

</div>

Hello Team,  
For metricbeat prometheus module we need output for a particular time interval.. How can we add the filter in at modules.d/prometheus.yml to get the output for a particular time interval.. Request for your help..  
Current prometheus.yml file is as follows.. How we can add time range in this prometheus.yml of metricbeat?

```auto
$ cat modules.d/prometheus.yml
- module: prometheus
  hosts: ["http://localhost:9090"]
  metrics_path: '/federate'
  ssl.verification_mode: none
  period: 20m
  query: 
    'match[]':
       - '{ __name__ =~"container_cpu.*|container_memory.*|container_network.*|alertmanager_alerts.*|kube_node_info.*"}'
  metrics_filters:
     include: []
     exclude: []

  # Use Elasticsearch histogram type to store histograms (beta, default: false)
  # This will change the default layout and put metric type in the field name
  use_types: true

```

---

<div class="post-metadata">

**Author:** ![Kaiyan\_Sheng](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kaiyan_sheng/32/38247_2.png) [@Kaiyan\_Sheng](https://discuss.elastic.co/u/Kaiyan_Sheng)\
**Post date:** [January 20, 2022, 5:36am UTC](https://discuss.elastic.co/t/add-time-range-filter-in-this-prometheus-yml-of-metricbeat-to-get-output-for-a-particular-time-interval/294822/2 "2022-01-20T05:36:16Z")

</div>

Hello! I don't think we support only collecting metrics from a set time frame in Metricbeat. But you can definitely do the filtering in Kibana after all the metrics are collected based on the timestamp field.

---

<div class="post-metadata">

**Author:** ![tweet2santosh86](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/tweet2santosh86/32/100531_2.png) [@tweet2santosh86](https://discuss.elastic.co/u/tweet2santosh86)\
**Post date:** [January 20, 2022, 9:24am UTC](https://discuss.elastic.co/t/add-time-range-filter-in-this-prometheus-yml-of-metricbeat-to-get-output-for-a-particular-time-interval/294822/3 "2022-01-20T09:24:28Z")

</div>

Thanks @Kaiyan_Sheng for your help. Looking forward for your subject matter expertise for many further queries in future.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [February 17, 2022, 11:25am UTC](https://discuss.elastic.co/t/add-time-range-filter-in-this-prometheus-yml-of-metricbeat-to-get-output-for-a-particular-time-interval/294822/4 "2022-02-17T11:25:19Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
