# Can ELK meets my need: make the subdirectory name a index key?

**URL:** <https://discuss.elastic.co/t/can-elk-meets-my-need-make-the-subdirectory-name-a-index-key/96241>\
**Category:** Logstash\
**Created:** [August 8, 2017, 10:16am UTC](https://discuss.elastic.co/t/can-elk-meets-my-need-make-the-subdirectory-name-a-index-key/96241 "2017-08-08T10:16:25Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![wuchang](https://avatars.discourse-cdn.com/v4/letter/w/5f9b8f/32.png) [@wuchang](https://discuss.elastic.co/u/wuchang)\
**Post date:** [August 8, 2017, 10:16am UTC](https://discuss.elastic.co/t/can-elk-meets-my-need-make-the-subdirectory-name-a-index-key/96241/1 "2017-08-08T10:16:25Z")

</div>

I am doing a reasearch on Logstash+ElasticSearch+Kibana to make sure they meet my needs .Below is the usage scenario:  
I want to use them for my Hadoop application logs search in a WEB UI. Since a hadoop application can be executed on any machine , so , check the application log is always cumbersome. A new application will create a directory under `/home/log/hadoop/logs/userlogs/` of the machine it is running on and create three log files: `syslog`、`syserr`、`sysout`.  
Currently, to check the log of a application , user get the applicationId(for example it is 123123123-223-1), and then goes to directory `/home/log/hadoop/logs/userlogs/123123123-223-1/` of each machine to check the logs files. Of cource , only the machine the application running on contains its logs.

So ,after deployed Logstash+ElasticSearch+Kibana ,I wonder if user can query the log for a specific applicaiton Id like this:  
For example , user input the applicationId 123123123-223-1as the query condition, ElasticSearch will return the log content for this application, that is to see, the file content under `/home/log/hadoop/logs/userlogs/123123123-223-1` which may locate on any machine of my cluster. That is to say, can the subdirectory name(the applicationId) be a index key so , user can just search its own application log?

---

<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:** [August 8, 2017, 11:12am UTC](https://discuss.elastic.co/t/can-elk-meets-my-need-make-the-subdirectory-name-a-index-key/96241/2 "2017-08-08T11:12:49Z")

</div>

Yes. You can use a grok filter to extract a portion of the file path and e.g. use it in the name of the ES index or just a field value in each event.

---

<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:** [September 5, 2017, 11:12am UTC](https://discuss.elastic.co/t/can-elk-meets-my-need-make-the-subdirectory-name-a-index-key/96241/3 "2017-09-05T11:12:50Z")

</div>

Closed on September 5, 2017, 11:12am UTC

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