# How I can run jdbc\_streaming filter just one time on multiple jdbc plugin row results

**URL:** <https://discuss.elastic.co/t/how-i-can-run-jdbc-streaming-filter-just-one-time-on-multiple-jdbc-plugin-row-results/274477>\
**Category:** Logstash\
**Created:** [May 31, 2021, 9:04am UTC](https://discuss.elastic.co/t/how-i-can-run-jdbc-streaming-filter-just-one-time-on-multiple-jdbc-plugin-row-results/274477 "2021-05-31T09:04:44Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![zeraf29](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/zeraf29/32/89215_2.png) [@zeraf29](https://discuss.elastic.co/u/zeraf29)\
**Post date:** [May 31, 2021, 9:04am UTC](https://discuss.elastic.co/t/how-i-can-run-jdbc-streaming-filter-just-one-time-on-multiple-jdbc-plugin-row-results/274477/1 "2021-05-31T09:04:45Z")

</div>

Hi.  
I want to run jdbc\_streaming filter plugin just one time on multiple jdbc plugin row results.

For example,  
I set jdbc input plugin in pipeline, and It return 10 table rows.

```auto
input{
  Jdbc{
     #jdbc settings
     Statement => “SELECT * FROM TABLE WHERE ROWNUM <= 10”
     #This jdbc plugin return 10 rows
  }
}

```

Also I set jdbc\_streaming filter like below.  
This jdbc\_streaming run 10 times. I think filter plugin run following input plugin results for editing them.

```auto
filter{
  Jdbc_streaming{
    #jdbc settings
      statement => “DELETE FROM TABLE WHERE reg_time<SYSDATE”
    #runnint 10 times because input plugin return 10 rows
  }
}

```

In this situation, I want to run jdbc\_streaming filter just one time even though input plugin get many rows(events).(I plan to use jdbc\_streaming only one time for removing rows which I selected by jdbc input plugin)

Please give me advises.  
and I hope you have always good days.

Thank you.

---

<div class="post-metadata">

**Author:** ![Wolfram\_Haussig](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/wolfram_haussig/32/70528_2.png) [@Wolfram\_Haussig](https://discuss.elastic.co/u/Wolfram_Haussig)\
**Post date:** [May 31, 2021, 11:36am UTC](https://discuss.elastic.co/t/how-i-can-run-jdbc-streaming-filter-just-one-time-on-multiple-jdbc-plugin-row-results/274477/2 "2021-05-31T11:36:30Z")

</div>

Hi,

I think the best way would be to select `rownum` and add [a conditional](https://www.elastic.co/guide/en/logstash/current/config-examples.html#using-conditionals) to only execute the streaming filter once(untested code):

```auto
filter{
  if [rownum] == 1 {
    Jdbc_streaming{
      #jdbc settings
      statement => “DELETE FROM TABLE WHERE reg_time<SYSDATE”
      #runnint 10 times because input plugin return 10 rows
    }
  }
}

```

Best regards  
Wolfram

---

<div class="post-metadata">

**Author:** ![zeraf29](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/zeraf29/32/89215_2.png) [@zeraf29](https://discuss.elastic.co/u/zeraf29)\
**Post date:** [June 1, 2021, 6:17am UTC](https://discuss.elastic.co/t/how-i-can-run-jdbc-streaming-filter-just-one-time-on-multiple-jdbc-plugin-row-results/274477/3 "2021-06-01T06:17:27Z")

</div>

Hi.  
Thanks to your solution, I could solve my problem.

Thank you so much again :D!

---

<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:** [June 29, 2021, 6:17am UTC](https://discuss.elastic.co/t/how-i-can-run-jdbc-streaming-filter-just-one-time-on-multiple-jdbc-plugin-row-results/274477/4 "2021-06-29T06:17:48Z")

</div>

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