# SOLVED: Logstash: how to expand numeric ranges? eg. 1-5 → 1 2 3 4 5

**URL:** <https://discuss.elastic.co/t/solved-logstash-how-to-expand-numeric-ranges-eg-1-5-1-2-3-4-5/67198>\
**Category:** Logstash\
**Created:** [November 25, 2016, 2:14pm UTC](https://discuss.elastic.co/t/solved-logstash-how-to-expand-numeric-ranges-eg-1-5-1-2-3-4-5/67198 "2016-11-25T14:14:30Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![jose\_d](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jose_d/32/13419_2.png) [@jose\_d](https://discuss.elastic.co/u/jose_d)\
**Post date:** [November 25, 2016, 2:14pm UTC](https://discuss.elastic.co/t/solved-logstash-how-to-expand-numeric-ranges-eg-1-5-1-2-3-4-5/67198/1 "2016-11-25T14:14:30Z")

</div>

Hi, i'm trying to analyze aggregated information from slurm HPC scheduler, and need to expand ranges like  
n[1-3,10-11] to n1,n2,n3,n10,n11.  
Could it be done with some existing filter?

---

<div class="post-metadata">

**Author:** ![magnusbaeck](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/magnusbaeck/32/44943_2.png) [@magnusbaeck](https://discuss.elastic.co/u/magnusbaeck)\
**Post date:** [November 29, 2016, 9:25pm UTC](https://discuss.elastic.co/t/solved-logstash-how-to-expand-numeric-ranges-eg-1-5-1-2-3-4-5/67198/2 "2016-11-29T21:25:16Z")

</div>

No, you'll have to use a ruby filter.

---

<div class="post-metadata">

**Author:** ![jose\_d](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jose_d/32/13419_2.png) [@jose\_d](https://discuss.elastic.co/u/jose_d)\
**Post date:** [December 9, 2016, 3:27pm UTC](https://discuss.elastic.co/t/solved-logstash-how-to-expand-numeric-ranges-eg-1-5-1-2-3-4-5/67198/3 "2016-12-09T15:27:28Z")

</div>

thx, solved with ruby filter and nodeset from clustershell project:

```
#expand nodelist, when present:

if "slurm_nodelist" in [tags] {
  ruby {
    code => "slurm_nodelist=event.get('slurm_nodelist');expanded_nodelist=`nodeset -e #{slurm_nodelist}`; event.set('nodelist', expanded_nodelist)"
  }
}
```

---

<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:** [January 6, 2017, 3:28pm UTC](https://discuss.elastic.co/t/solved-logstash-how-to-expand-numeric-ranges-eg-1-5-1-2-3-4-5/67198/4 "2017-01-06T15:28:03Z")

</div>

Closed on January 6, 2017, 3:28pm UTC

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