# Timestamp at Input section

**URL:** <https://discuss.elastic.co/t/timestamp-at-input-section/59600>\
**Category:** Logstash\
**Created:** [September 1, 2016, 8:50pm UTC](https://discuss.elastic.co/t/timestamp-at-input-section/59600 "2016-09-01T20:50:44Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![sombilat](https://avatars.discourse-cdn.com/v4/letter/s/779978/32.png) [@sombilat](https://discuss.elastic.co/u/sombilat)\
**Post date:** [September 1, 2016, 8:50pm UTC](https://discuss.elastic.co/t/timestamp-at-input-section/59600/1 "2016-09-01T20:50:44Z")

</div>

Hello Guys,

I am utilizing the @timestamp field in a DB2 Query. I am using the JDBC plugin, where in I am relying on the @timestamp field for my date parameters.

Now, thing is I cannot use the @timestamp because it has the T, Z and : in it's value(2016-09-01T19:21:08.702Z). Is there a way to parse it at the input section so I can omit the T, Z and colons?

---

<div class="post-metadata">

**Author:** ![andrewvc](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/andrewvc/32/5064_2.png) [@andrewvc](https://discuss.elastic.co/u/andrewvc)\
**Post date:** [September 1, 2016, 8:56pm UTC](https://discuss.elastic.co/t/timestamp-at-input-section/59600/2 "2016-09-01T20:56:13Z")

</div>

Can you share your config? You can generally format dates using sprintf format like `%{yyyy-mm-dd}`

---

<div class="post-metadata">

**Author:** ![sombilat](https://avatars.discourse-cdn.com/v4/letter/s/779978/32.png) [@sombilat](https://discuss.elastic.co/u/sombilat)\
**Post date:** [September 1, 2016, 9:09pm UTC](https://discuss.elastic.co/t/timestamp-at-input-section/59600/3 "2016-09-01T21:09:55Z")

</div>

Hi Andrew,

I cant share my config File.  
I tried to google that sprintf you indicated. As I saw in the documentation, this cannot be done in the Input section.

> _Field references, sprintf format and conditionals, described below,_  
> _will not work in an input block._

Also, as I see in the examples it is only used in the outputs. Is there no other way? 😃

---

<div class="post-metadata">

**Author:** ![andrewvc](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/andrewvc/32/5064_2.png) [@andrewvc](https://discuss.elastic.co/u/andrewvc)\
**Post date:** [September 1, 2016, 9:11pm UTC](https://discuss.elastic.co/t/timestamp-at-input-section/59600/4 "2016-09-01T21:11:33Z")

</div>

How are you pulling the timestamp from `@timestamp` in an input? There's no event to pull it from.

This is far too confusing to understand without a config file. Can you just share your JDBC input config?

---

<div class="post-metadata">

**Author:** ![sombilat](https://avatars.discourse-cdn.com/v4/letter/s/779978/32.png) [@sombilat](https://discuss.elastic.co/u/sombilat)\
**Post date:** [September 1, 2016, 9:14pm UTC](https://discuss.elastic.co/t/timestamp-at-input-section/59600/5 "2016-09-01T21:14:27Z")

</div>

Hello!

Yep, that I can share.

> input {
> 
> ```
> if [@timestamp] < "01:00:00.000Z" and [@timestamp] > "02:00:00.000Z" {
> stdin {
> add_field => { "dummy" => "'2016-09-01-00.00.00' AND '2016-09-01-02.59.00'"}
> }
> }
> 
> jdbc {
> jdbc_driver_library => "jarFiles/db2jcc-10.1.0.jar"
> jdbc_driver_class => "com.ibm.db2.jcc.DB2Driver"
> jdbc_connection_string => "jdbc:db2://localhost:9200/dummyDB"
> schedule => "59 * * * *"
> statement => "select content from rawbcmsg where LASTUPDATE BETWEEN %{dummy}"
> type => "CDT1"
> }
> 
> ```
> 
> }

Thanks,

---

<div class="post-metadata">

**Author:** ![andrewvc](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/andrewvc/32/5064_2.png) [@andrewvc](https://discuss.elastic.co/u/andrewvc)\
**Post date:** [September 1, 2016, 9:16pm UTC](https://discuss.elastic.co/t/timestamp-at-input-section/59600/6 "2016-09-01T21:16:11Z")

</div>

I think the confusion here is that the `stdin` input does not at all have any way to conect to the `jdbc` input. You would need a JDBC filter which we do not unfortunately have. It'd be awesome if someone made one however!

---

<div class="post-metadata">

**Author:** ![andrewvc](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/andrewvc/32/5064_2.png) [@andrewvc](https://discuss.elastic.co/u/andrewvc)\
**Post date:** [September 1, 2016, 9:16pm UTC](https://discuss.elastic.co/t/timestamp-at-input-section/59600/7 "2016-09-01T21:16:32Z")

</div>

To expand on that, inputs can only generate events, they cannot react to other inputs.

---

<div class="post-metadata">

**Author:** ![sombilat](https://avatars.discourse-cdn.com/v4/letter/s/779978/32.png) [@sombilat](https://discuss.elastic.co/u/sombilat)\
**Post date:** [September 1, 2016, 9:17pm UTC](https://discuss.elastic.co/t/timestamp-at-input-section/59600/8 "2016-09-01T21:17:31Z")

</div>

I guess that answers my question Andrew,Thanks.

---

<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, 4:40am UTC](https://discuss.elastic.co/t/timestamp-at-input-section/59600/9 "2017-07-06T04:40:21Z")

</div>

Closed on July 6, 2017, 4:40am UTC


