# How to create visualization group by part of file name?

**URL:** <https://discuss.elastic.co/t/how-to-create-visualization-group-by-part-of-file-name/74414>\
**Category:** Kibana\
**Created:** [February 8, 2017, 5:04pm UTC](https://discuss.elastic.co/t/how-to-create-visualization-group-by-part-of-file-name/74414 "2017-02-08T17:04:42Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![vinsse2001](https://avatars.discourse-cdn.com/v4/letter/v/49beb7/32.png) [@vinsse2001](https://discuss.elastic.co/u/vinsse2001)\
**Post date:** [February 8, 2017, 5:04pm UTC](https://discuss.elastic.co/t/how-to-create-visualization-group-by-part-of-file-name/74414/1 "2017-02-08T17:04:42Z")

</div>

Hi,

I'm trying to create a visualization in Kibana (v4.6.1) so as to list log files by part of their names.

For example, I can view this files in Kibana :  
/path1/path2/path3/myapp1.log.2017-02-07 =\> 1000 lines  
/path1/path2/path3/myapp1.log.2017-02-06 =\> 500 lines  
/path1/path4/path5/myapp2.log =\> 2000 lines  
/path1/path4/path5/myapp2.log.2017-02-07 =\> 300 lines

Is it possible to have a data table with one tag "myapp1.log" to see all "myapp1" logs, etc :  
myapp1.log 1500  
myapp2.log 2300

Thanks !

---

<div class="post-metadata">

**Author:** ![ppisljar](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ppisljar/32/11588_2.png) [@ppisljar](https://discuss.elastic.co/u/ppisljar)\
**Post date:** [February 9, 2017, 8:15am UTC](https://discuss.elastic.co/t/how-to-create-visualization-group-by-part-of-file-name/74414/2 "2017-02-09T08:15:06Z")

</div>

you would need to index your data in a way that myapp1.log would be a separate field, then you could do that.

with filenames being in its current form you could try to use a scripted field to extract just the filename

go to management-\>index-\>scripted fields-\>add

try to add a scripted field .... depends how much assumptions can you make about your data.  
i am making an assumption that your path includes a `/` and has a filename 10 chars long

dont forget to set field type to string (in this case)

`if (doc['referer'].value.lastIndexOf('/') + 5 < doc['referer'].value.length()) { return doc['referer'].value.substring(doc['referer'].value.lastIndexOf('/'), doc['referer'].value.lastIndexOf('/') + 5) } else { return ''; }`

now you could go to data table, select term aggregation and select your scripted field

---

<div class="post-metadata">

**Author:** ![vinsse2001](https://avatars.discourse-cdn.com/v4/letter/v/49beb7/32.png) [@vinsse2001](https://discuss.elastic.co/u/vinsse2001)\
**Post date:** [February 9, 2017, 9:51am UTC](https://discuss.elastic.co/t/how-to-create-visualization-group-by-part-of-file-name/74414/3 "2017-02-09T09:51:46Z")

</div>

Thanks ppisljar,

But I don't think I can do this, I'm using Kibana in a big company, with so much logs to index that administrators prefers only keep standard fields and avoid to create specific ones...  
And I don't see "management" in my kibana view, so I think I don't have (admin ?) rights to do this.

Is there a solution, only with visualization and playing with data / buckets ?

Vincent

---

<div class="post-metadata">

**Author:** ![ppisljar](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ppisljar/32/11588_2.png) [@ppisljar](https://discuss.elastic.co/u/ppisljar)\
**Post date:** [February 9, 2017, 12:58pm UTC](https://discuss.elastic.co/t/how-to-create-visualization-group-by-part-of-file-name/74414/4 "2017-02-09T12:58:00Z")

</div>

unfortunately none that i am aware of.

---

<div class="post-metadata">

**Author:** ![vinsse2001](https://avatars.discourse-cdn.com/v4/letter/v/49beb7/32.png) [@vinsse2001](https://discuss.elastic.co/u/vinsse2001)\
**Post date:** [February 9, 2017, 4:18pm UTC](https://discuss.elastic.co/t/how-to-create-visualization-group-by-part-of-file-name/74414/5 "2017-02-09T16:18:18Z")

</div>

thanks for having tried 😉

---

<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:** [March 9, 2017, 4:18pm UTC](https://discuss.elastic.co/t/how-to-create-visualization-group-by-part-of-file-name/74414/6 "2017-03-09T16:18:38Z")

</div>

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