# CSV Import - Keys sporadically wrong

**URL:** <https://discuss.elastic.co/t/csv-import-keys-sporadically-wrong/168589>\
**Category:** Logstash\
**Created:** [February 15, 2019, 12:57pm UTC](https://discuss.elastic.co/t/csv-import-keys-sporadically-wrong/168589 "2019-02-15T12:57:30Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![tbra](https://avatars.discourse-cdn.com/v4/letter/t/b3f665/32.png) [@tbra](https://discuss.elastic.co/u/tbra)\
**Post date:** [February 15, 2019, 12:57pm UTC](https://discuss.elastic.co/t/csv-import-keys-sporadically-wrong/168589/1 "2019-02-15T12:57:30Z")

</div>

Hello,

I have this simple csv test file:

```
D1,A1,A2,A3
15.2.2019,Firstname1,Lastname1,1200
16.2.2019,Firstname2,Lastname2,2200

```

which I import with this config file:

```
input {
  file {
    path => "/Users/tbra/appl/elastic/logstash-6.6.0/input/test.csv"
    start_position => "beginning"
    sincedb_path => "/dev/null"
  }
}

filter {
  csv {
    separator => ","
    autodetect_column_names => true
    autogenerate_column_names => true
  }
}

output {
  stdout {}
}

```

When I start logstash I receive this correct output:

```
{
 "A2" => "Lastname1",
 "A3" => "1200",
 "path" => "/Users/tbra/appl/elastic/logstash-6.6.0/input/test.csv",
 "@timestamp" => 2019-02-15T12:41:15.762Z,
 "@version" => "1",
 "message" => "15.2.2019,Firstname1,Lastname1,1200",
 "host" => "TBRMac.local",
  "D1" => "15.2.2019",
  "A1" => "Firstname1"
}
{
"A2" => "Lastname2",
"A3" => "2200",
"path" => "/Users/tbra/appl/elastic/logstash-6.6.0/input/test.csv",
"@timestamp" => 2019-02-15T12:41:15.763Z,
"@version" => "1",
"message" => "16.2.2019,Firstname2,Lastname2,2200",
"host" => "TBRMac.local",
"D1" => "16.2.2019",
 "A1" => "Firstname2"
}

```

After restarting logstash I receive this wrong output:

```
{
"host" => "TBRMac.local",
"15.2.2019" => "D1",
"1200" => "A3",
"@version" => "1",
"path" => "/Users/tbra/appl/elastic/logstash-6.6.0/input/test.csv",
"@timestamp" => 2019-02-15T12:42:00.346Z,
"Firstname1" => "A1",
"message" => "D1,A1,A2,A3",
"Lastname1" => "A2"
}
{
"host" => "TBRMac.local",
"15.2.2019" => "16.2.2019",
"1200" => "2200",
"@version" => "1",
"path" => "/Users/tbra/appl/elastic/logstash-6.6.0/input/test.csv",
"@timestamp" => 2019-02-15T12:42:00.432Z,
"Firstname1" => "Firstname2",
"message" => "16.2.2019,Firstname2,Lastname2,2200",
"Lastname1" => "Lastname2"
}

```

What am I doing wrong ?  
Thanks, best regards  
Thomas

P.S: I am using Logstash 6.6.0

---

<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:** [February 15, 2019, 1:37pm UTC](https://discuss.elastic.co/t/csv-import-keys-sporadically-wrong/168589/2 "2019-02-15T13:37:17Z")

</div>

Have you set --pipeline.workers 1 ?

---

<div class="post-metadata">

**Author:** ![tbra](https://avatars.discourse-cdn.com/v4/letter/t/b3f665/32.png) [@tbra](https://discuss.elastic.co/u/tbra)\
**Post date:** [February 15, 2019, 4:10pm UTC](https://discuss.elastic.co/t/csv-import-keys-sporadically-wrong/168589/3 "2019-02-15T16:10:25Z")

</div>

Hello Badger,

thank you - that was the solution 🙂

Maybe this important precondition should be prominent in the cvs plugin documentation.

Best regards  
Thomas

---

<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:** [February 15, 2019, 4:20pm UTC](https://discuss.elastic.co/t/csv-import-keys-sporadically-wrong/168589/4 "2019-02-15T16:20:11Z")

</div>

I agree. There is a [issue](https://github.com/logstash-plugins/logstash-filter-csv/issues/65) open for the underlying problem, but it would be good to get the requirement into the documentation, because the issue is unlikely to get fixed, so the requirement will not change.

---

<div class="post-metadata">

**Author:** ![danhermann](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/danhermann/32/33024_2.png) [@danhermann](https://discuss.elastic.co/u/danhermann)\
**Post date:** [February 15, 2019, 5:00pm UTC](https://discuss.elastic.co/t/csv-import-keys-sporadically-wrong/168589/5 "2019-02-15T17:00:48Z")

</div>

Agreed that it should at least be documented: [https://github.com/logstash-plugins/logstash-filter-csv/pull/70](https://github.com/logstash-plugins/logstash-filter-csv/pull/70)

---

<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:** [March 15, 2019, 5:00pm UTC](https://discuss.elastic.co/t/csv-import-keys-sporadically-wrong/168589/6 "2019-03-15T17:00:49Z")

</div>

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