Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Certain @fields are reserved fields and should not be removed. #6728

Open
guyboertje opened this issue Feb 17, 2017 · 8 comments
Open

Certain @fields are reserved fields and should not be removed. #6728

guyboertje opened this issue Feb 17, 2017 · 8 comments

Comments

@guyboertje
Copy link
Contributor

We need an enhancement to the remove_field code that should check if a field is reserved, ignore that field and log warn this.

Removing the @timestamp field will cause undefined method for nil class when trying to use it later.

@liketic
Copy link
Contributor

liketic commented Sep 28, 2017

@suyograo Can I take this?

@andrewvc
Copy link
Contributor

andrewvc commented Feb 7, 2018

Why is it that @timestamp should not be removable? Is this actually a bug?

While I understand that is the behavior today, is that intentional?

I think it's fine for us to decide that certain fields are reserved, but I'd like to understand the history of those fields before we flag them specially.

In Logstash 2.2.2 for instance

bin/logstash -e 'input { generator {} } filter { mutate { remove => "@timestamp" } } output { stdout { codec => json_lines } }'

ran successfully.

As did

bin/logstash -e 'input { generator {} } filter { mutate { remove => "@metadata" } } output { stdout { codec => json_lines } }'

This feels more like accidental behavior to me as a result of moving the Event class to Java.

@guyboertje
Copy link
Contributor Author

I believe it is the elasticsearch output mechanism that breaks on @timestamp removal.

@AbdulHaseebHussain
Copy link

What should the next steps be in regards to this issue?

@guyboertje
Copy link
Contributor Author

@andrewvc

Dynamic values that use time format String interpolations fail without a timestamp.
Like when setting a time based index name or a day_of_week field.

The Java code expects that the timestamp is never null. https://github.com/elastic/logstash/blob/master/logstash-core/src/main/java/org/logstash/StringInterpolation.java#L44

@guyboertje
Copy link
Contributor Author

@AbdulHaseebHussain
Copy link

Maybe this restriction of preventing deletion of reserved fields could be restricted to the timestamp field.

@andrewvc
Copy link
Contributor

andrewvc commented Feb 26, 2018 via email

@jsvd jsvd added hacktoberfest "Everyone is welcome, Quantity is fun, quality is key, Short term actions, long term impact" and removed hacktoberfest "Everyone is welcome, Quantity is fun, quality is key, Short term actions, long term impact" labels Oct 1, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

7 participants