# How to work with event "message" in Java filter plugin?

**URL:** https://discuss.elastic.co/t/how-to-work-with-event-message-in-java-filter-plugin/254258
**Category:** Logstash
**Created:** [November 4, 2020, 11:17am UTC](https://discuss.elastic.co/t/how-to-work-with-event-message-in-java-filter-plugin/254258 "2020-11-04T11:17:18Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![toni1](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/toni1/32/78389_2.png) [@toni1](https://discuss.elastic.co/u/toni1)
#### Post date: [November 4, 2020, 11:17am UTC](https://discuss.elastic.co/t/how-to-work-with-event-message-in-java-filter-plugin/254258/1 "2020-11-04T11:17:18Z")

</div>

Hi,  
I am developing a Java Filter Plugin to merge different CSVs, and as I'm trying to process them, I need to extract the message field (which contains the whole CSV line).  
How am I supposed to do so using Java language?  
The "message" field is the one I want to process later.  
 ![image](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1a2c6a3939a313895e8e2ade16f5df7c36b7ebe2.png)

The filter method provided by Logstash is :

```auto
@Override
public Collection<Event> filter(Collection<Event> events, FilterMatchListener matchListener) {
    for (Event e : events) {
        Object f = e.getField(sourceField);
        if (f instanceof String) {
            e.setField(sourceField, StringUtils.reverse((String)f));
            **//Here I would implement logic to generate CSV files** 
            matchListener.filterMatched(e);
        }
    }
    return events;

```

I am trying to do something like filewriter.write(messageField) and then I am planning on processing the new generated CSV files.

Thank you!

---

<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: [December 2, 2020, 11:17am UTC](https://discuss.elastic.co/t/how-to-work-with-event-message-in-java-filter-plugin/254258/2 "2020-12-02T11:17:24Z")

</div>

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