# Listening for slow queries?

**URL:** <https://discuss.elastic.co/t/listening-for-slow-queries/7482>\
**Category:** Elasticsearch\
**Created:** [April 26, 2012, 7:47pm UTC](https://discuss.elastic.co/t/listening-for-slow-queries/7482 "2012-04-26T19:47:21Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![otisg](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/otisg/32/492_2.png) [@otisg](https://discuss.elastic.co/u/otisg)\
**Post date:** [April 26, 2012, 7:47pm UTC](https://discuss.elastic.co/t/listening-for-slow-queries/7482/1 "2012-04-26T19:47:21Z")

</div>

Hello,

Is there any way to hook up to ES and listed for slow queries? By slow  
queries I mean  
[http://www.elasticsearch.org/guide/reference/index-modules/slowlog.html](http://www.elasticsearch.org/guide/reference/index-modules/slowlog.html) .  
I'd love to be able to have some sort of a listener and do something  
custom (e.g. log elsewhere, index, analyze, rewrite, etc.) with slow  
queries.

If there is no way to do that, should I open an issue?

## Thanks, Otis

ElasticSearch Performance Monitoring - [http://sematext.com/spm/index.html](http://sematext.com/spm/index.html)

---

<div class="post-metadata">

**Author:** ![Igor\_Motov](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/igor_motov/32/45193_2.png) [@Igor\_Motov](https://discuss.elastic.co/u/Igor_Motov)\
**Post date:** [April 28, 2012, 5:24am UTC](https://discuss.elastic.co/t/listening-for-slow-queries/7482/2 "2012-04-28T05:24:12Z")

</div>

Otis,

Slow queries are logged by a standard ES logger. The logging.xml file  
configures this logger to use DailyRollingFileAppender to log slow query  
messages to a separate file. You can replace DailyRollingFileAppender with  
your own custom appender by adding your appender to the elasticsearch  
classpath and specifying your appender's class name in

appender:  
index\_search\_slow\_log\_file:  
type: com.sematext.YourCustomAppender  
...

Igor

On Thursday, April 26, 2012 3:47:21 PM UTC-4, Otis Gospodnetic wrote:

> Hello,
> 
> Is there any way to hook up to ES and listed for slow queries? By slow  
> queries I mean  
> [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/reference/index-modules/slowlog.html) .  
> I'd love to be able to have some sort of a listener and do something  
> custom (e.g. log elsewhere, index, analyze, rewrite, etc.) with slow  
> queries.
> 
> If there is no way to do that, should I open an issue?
> 
> ## Thanks, Otis
> 
> Elasticsearch Performance Monitoring - [Sematext Monitoring | Infrastructure Monitoring Service](http://sematext.com/spm/index.html)

---

<div class="post-metadata">

**Author:** ![kimchy](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kimchy/32/44952_2.png) [@kimchy](https://discuss.elastic.co/u/kimchy)\
**Post date:** [April 29, 2012, 5:30pm UTC](https://discuss.elastic.co/t/listening-for-slow-queries/7482/3 "2012-04-29T17:30:49Z")

</div>

As igore pointed out, an appender is the only way to go. We could allow for  
plugins to register custom listeners for it.

On Sat, Apr 28, 2012 at 8:24 AM, Igor Motov [imotov@gmail.com](mailto:imotov@gmail.com) wrote:

> Otis,
> 
> Slow queries are logged by a standard ES logger. The logging.xml file  
> configures this logger to use DailyRollingFileAppender to log slow query  
> messages to a separate file. You can replace DailyRollingFileAppender with  
> your own custom appender by adding your appender to the elasticsearch  
> classpath and specifying your appender's class name in
> 
> appender:  
> index\_search\_slow\_log\_file:  
> type: com.sematext.YourCustomAppender  
> ...
> 
> Igor
> 
> On Thursday, April 26, 2012 3:47:21 PM UTC-4, Otis Gospodnetic wrote:
> 
> > Hello,
> > 
> > Is there any way to hook up to ES and listed for slow queries? By slow  
> > queries I mean [http://www.elasticsearch](http://www.elasticsearch). **org/guide/reference/index-**  
> > modules/slowlog.html[http://www.elasticsearch.org/guide/reference/index-modules/slowlog.html](http://www.elasticsearch.org/guide/reference/index-modules/slowlog.html) .  
> > I'd love to be able to have some sort of a listener and do something  
> > custom (e.g. log elsewhere, index, analyze, rewrite, etc.) with slow  
> > queries.
> > 
> > If there is no way to do that, should I open an issue?
> > 
> > ## Thanks, Otis
> > 
> > Elasticsearch Performance Monitoring - [http://sematext.com/spm/index.](http://sematext.com/spm/index.)\*\*  
> > html [http://sematext.com/spm/index.html](http://sematext.com/spm/index.html)

---

<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, 3:30am UTC](https://discuss.elastic.co/t/listening-for-slow-queries/7482/4 "2017-07-06T03:30:38Z")

</div>


