# Log for ALL elasticsearch search queries, query latency, and query hits

**URL:** <https://discuss.elastic.co/t/log-for-all-elasticsearch-search-queries-query-latency-and-query-hits/16517>\
**Category:** Elasticsearch\
**Created:** [March 21, 2014, 8:17am UTC](https://discuss.elastic.co/t/log-for-all-elasticsearch-search-queries-query-latency-and-query-hits/16517 "2014-03-21T08:17:42Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Dhruv\_Garg](https://avatars.discourse-cdn.com/v4/letter/d/d78d45/32.png) [@Dhruv\_Garg](https://discuss.elastic.co/u/Dhruv_Garg)\
**Post date:** [March 21, 2014, 8:17am UTC](https://discuss.elastic.co/t/log-for-all-elasticsearch-search-queries-query-latency-and-query-hits/16517/1 "2014-03-21T08:17:42Z")

</div>

Hey folks,

I'd like to setup logstash to keep track of all search queries made against  
my elasticsearch cluster along with the amount of time it takes to return  
the results and number of results returned. Ideally the log file should  
contain something like:

{ query: foobar, time\_taken: 100ms, num\_hits: 5 }

Does elasticsearch expose a logfile that contains this information? I could  
only see the query\_slow and index\_slow log files, which contain a subset of  
the information I'd like logstash to process.

Worst case, I log this data in the application layer, but it would be nice  
if elasticsearch took care of it - better separation of concerns.

Thanks,

Dhruv

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/88771eba-8abf-49e3-a8e6-c4df00fcdacc%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/88771eba-8abf-49e3-a8e6-c4df00fcdacc%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<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:** [July 6, 2017, 1:41am UTC](https://discuss.elastic.co/t/log-for-all-elasticsearch-search-queries-query-latency-and-query-hits/16517/2 "2017-07-06T01:41:38Z")

</div>


