# Input file and input jdbc

**URL:** <https://discuss.elastic.co/t/input-file-and-input-jdbc/308587>\
**Category:** Logstash\
**Created:** [June 30, 2022, 1:51pm UTC](https://discuss.elastic.co/t/input-file-and-input-jdbc/308587 "2022-06-30T13:51:17Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Calvete](https://avatars.discourse-cdn.com/v4/letter/c/5f9b8f/32.png) [@Calvete](https://discuss.elastic.co/u/Calvete)\
**Post date:** [June 30, 2022, 1:51pm UTC](https://discuss.elastic.co/t/input-file-and-input-jdbc/308587/1 "2022-06-30T13:51:17Z")

</div>

Hi

I want to get the name of the csv file and then that value use it in a select of another input in database

input {  
file {  
path =\> "C:/Users/a/Downloads/bucket/\*.csv"  
start\_position =\> "beginning"  
sincedb\_path =\> "NULL"  
tags =\> ["load\_file"]  
}  
jdbc {  
driver\_jar\_path =\> "C:\logstash-7.14.0\postgresql-42.3.1.jar"  
driver\_class =\> "org.postgresql.Driver"  
connection\_string =\> "jdbc:postgresql://database"  
username =\> "postgres"  
password =\> "postgres"  
statement =\> ["SELECT sff,cc FROM public.table WHERE id=namefile"]  
tags =\> ["select\_db"]  
}

```
}

```

---

<div class="post-metadata">

**Author:** ![Badger](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/badger/32/25190_2.png) [@Badger](https://discuss.elastic.co/u/Badger)\
**Post date:** [June 30, 2022, 4:34pm UTC](https://discuss.elastic.co/t/input-file-and-input-jdbc/308587/2 "2022-06-30T16:34:52Z")

</div>

> [@Calvete](#):
>
> sincedb\_path =\> "NULL"

That will persist the in-memory sincedb to a file called NULL in the working directory of logstash. If you do not want the sincedb persisted across restarts then set it to "NUL".

When the inputs are configured there are no events, so the configuration of an input cannot use a sprintf reference to a field on an event. However, filter plugins can.

You may be able to do it using a jdbc\_streaming filter. That always returns an array of hashes (each array entry a row, each set of columns a hash, even if it is only one column). You could then use a split filter to get one event per row.

---

<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 28, 2022, 4:35pm UTC](https://discuss.elastic.co/t/input-file-and-input-jdbc/308587/3 "2022-07-28T16:35:30Z")

</div>

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