3

I use SocketAppender to report log events to logstash which connect to elasticsearch. I record some application context info by using MDC. I hope to filter events by MDC fields. How to make mdc fields indexed or analyzed in logstash with elasticsearch?

for example: I write : MDC.put("email", "11111@example.com") in my java code. I would like to search events by email:11111@example.com which event have email field matched. but now , return results also matched example.

  • You'll need to add a logstash filter to parse that field and also probably set the proper mapping/analyzer for that field in ES. Can you show us a sample log line? – Val May 13 '15 at 03:32
  • Related: https://stackoverflow.com/questions/53558553/append-specific-mdc-field-into-logstash-log – Vadzim Jun 28 '21 at 12:47

0 Answers0