logstash-filter-csv icon indicating copy to clipboard operation
logstash-filter-csv copied to clipboard

Column Names keyword bug

Open AbdulHaseebHussain opened this issue 7 years ago • 3 comments

When columns names are the same as keywords unexpected things happen, e.g. when tags is used as a column name the value is added within the logstash tags array.

This is due to column name values being called using event.get so there is no difference is syntax. Needs to be rectified somehow.

AbdulHaseebHussain avatar Jan 04 '18 23:01 AbdulHaseebHussain

Can you give examples?

guyboertje avatar Jan 09 '18 10:01 guyboertje

When "tags" is given as a column name event.get("tags") returns ["hello"] instead of "hello" as it expects tags such "_grokparsefailure" etc. which would be appended to the above array when they occur which is not expected by users.

`let(:doc) { "big,bird,sesame street,hello" } let(:config) do { "columns" => ["first", "last", "address", "tags" ] } end

it "extract all the values" do plugin.filter(event) expect(event.get("first")).to eq("big") expect(event.get("last")).to eq("bird") expect(event.get("address")).to eq("sesame street") expect(event.get("tags")).to eq("hello") end`

AbdulHaseebHussain avatar Jan 09 '18 20:01 AbdulHaseebHussain

I think that is expected. logstash makes assumptions about the types of certain fields. [tags] has to be an array, [@timestamp] has to be a LogStash::Timestamp, or else things break. There may be others. It is not documented, it just is.

TheVastyDeep avatar Jun 16 '21 02:06 TheVastyDeep