# Logstash CSV Output all fields are not working

**URL:** <https://discuss.elastic.co/t/logstash-csv-output-all-fields-are-not-working/282985>\
**Category:** Logstash\
**Created:** [September 1, 2021, 4:41am UTC](https://discuss.elastic.co/t/logstash-csv-output-all-fields-are-not-working/282985 "2021-09-01T04:41:32Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![yogicd](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/yogicd/32/93629_2.png) [@yogicd](https://discuss.elastic.co/u/yogicd)\
**Post date:** [September 1, 2021, 4:41am UTC](https://discuss.elastic.co/t/logstash-csv-output-all-fields-are-not-working/282985/1 "2021-09-01T04:41:32Z")

</div>

Hello,  
I am testing to get the all the data in .CSV file and unable to get the all the fields and nested in the.CSV file,My config file as below  
input {  
stdin {}  
beats {  
port =\> 5044  
}  
}

output {  
csv {  
#fields =\> ["@timestamp","message","version","architecture"]  
fields =\> ["@timestamp","event.dataset","host.mac","host.hostname","host.os.name","host.ip","log.file.path","message","service.type"]  
path =\> "/tmp/excel/syslogout.csv"  
}  
}

If i run this i will get the only fields @timestamp and message in my syslogout.csv output file.  
2021-09-01T04:25:10.274Z,,,,,,,"type=USER\_END msg=audit(1630470302.625:1690): pid=26515 uid=0 auid=987 ses=203 msg='op=PAM:session\_close grantors=pam\_loginuid,pam\_keyinit,pam\_limits,pam\_systemd acct=""pcp"" exe=""/usr/sbin/crond"" hostname=? addr=? terminal=cron res=success'",

Using version Elasticsearch7.14,kibana 7.14,logstash7.14,filebeat 7.14

---

<div class="post-metadata">

**Author:** ![Cad](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/cad/32/86661_2.png) [@Cad](https://discuss.elastic.co/u/Cad)\
**Post date:** [September 1, 2021, 12:36pm UTC](https://discuss.elastic.co/t/logstash-csv-output-all-fields-are-not-working/282985/2 "2021-09-01T12:36:45Z")

</div>

Hi,

In the csv output plugin documentation, you can read this about the fields option :  
`If a field does not exist on the event, an empty string will be written. Supports field reference syntax eg: fields => ["field1", "[nested][field]"].`

So in your case, to take into account nested fields, your fields option should be like this :

```auto
fields => ["@timestamp","[event][dataset]","[host][mac]","[host][hostname]","[host][os][name]","[host][ip]","[log][file][path]","message","[service][type]"]

```

If the result does not change, it means that your nested fields do not exist.

Cad.

---

<div class="post-metadata">

**Author:** ![yogicd](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/yogicd/32/93629_2.png) [@yogicd](https://discuss.elastic.co/u/yogicd)\
**Post date:** [September 2, 2021, 5:55am UTC](https://discuss.elastic.co/t/logstash-csv-output-all-fields-are-not-working/282985/3 "2021-09-02T05:55:32Z")

</div>

Hi Cad,  
Thanks for the suggestion,I will check and revert.

Yogesh

---

<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:** [September 30, 2021, 5:55am UTC](https://discuss.elastic.co/t/logstash-csv-output-all-fields-are-not-working/282985/4 "2021-09-30T05:55:49Z")

</div>

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