# Fleet Agent Cannot Export to CSV

**URL:** <https://discuss.elastic.co/t/fleet-agent-cannot-export-to-csv/374752>\
**Category:** Elasticsearch\
**Tags:** fleet\
**Created:** [February 19, 2025, 10:39am UTC](https://discuss.elastic.co/t/fleet-agent-cannot-export-to-csv/374752 "2025-02-19T10:39:51Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![kulisiber](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kulisiber/32/141483_2.png) [@kulisiber](https://discuss.elastic.co/u/kulisiber)\
**Post date:** [February 19, 2025, 10:39am UTC](https://discuss.elastic.co/t/fleet-agent-cannot-export-to-csv/374752/1 "2025-02-19T10:39:51Z")

</div>

I have a need to list all fleet agents with status and such for document purposes. I didn't find an export agent feature like on the Wazuh Dashboard. As a result, I tried to query Dev Tools but still didn't get the right status results. Do you have any suggestions or do I have to manually copy one by one from hundreds of total agents?

Honestly, the lack of an agent status export feature made me waste a lot of time. Until now i can't get a result query information like Status, Agent Policy, CPU, Memory.

![gambar](https://us1.discourse-cdn.com/elastic/optimized/3X/c/0/c0920feafc2d89b3387e71e24f51ff571806fad4_2_690x31.png)

---

<div class="post-metadata">

**Author:** ![ahmed\_charafouddine](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ahmed_charafouddine/32/45129_2.png) [@ahmed\_charafouddine](https://discuss.elastic.co/u/ahmed_charafouddine)\
**Post date:** [February 19, 2025, 11:20am UTC](https://discuss.elastic.co/t/fleet-agent-cannot-export-to-csv/374752/2 "2025-02-19T11:20:04Z")

</div>

maybe in the .fleet-policies\* index you will find the information you are looking for?

---

<div class="post-metadata">

**Author:** ![kpollich](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kpollich/32/93788_2.png) [@kpollich](https://discuss.elastic.co/u/kpollich)\
**Post date:** [February 19, 2025, 2:20pm UTC](https://discuss.elastic.co/t/fleet-agent-cannot-export-to-csv/374752/3 "2025-02-19T14:20:00Z")

</div>

Howdy - we've added an "export CSV" feature to the agents listing table that will be available starting in 8.18.

- [[Fleet] Added Export CSV bulk action to Agent list by juliaElastic · Pull Request #196635 · elastic/kibana · GitHub](https://github.com/elastic/kibana/pull/196635)
- [[Fleet] Feature to support columns when exporting agents to CSV by juliaElastic · Pull Request #203103 · elastic/kibana · GitHub](https://github.com/elastic/kibana/pull/203103)
- [[Fleet] added tour component, removed search by juliaElastic · Pull Request #203741 · elastic/kibana · GitHub](https://github.com/elastic/kibana/pull/203741)

If upgrading your stack isn't an option, you can use the Fleet API's `/agents` endpoint to fetch all of your agents and convert the results to a CSV using `jq` or another tool. See API docs [here](https://www.elastic.co/docs/api/doc/kibana/operation/operation-get-fleet-agents).

---

<div class="post-metadata">

**Author:** ![leandrojmp](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/leandrojmp/32/107231_2.png) [@leandrojmp](https://discuss.elastic.co/u/leandrojmp)\
**Post date:** [February 19, 2025, 2:38pm UTC](https://discuss.elastic.co/t/fleet-agent-cannot-export-to-csv/374752/4 "2025-02-19T14:38:38Z")

</div>

You could run this query in Kibana Dev Tools

```auto
GET _sql?format=csv
{
  "query": """
    SELECT "local_metadata.host.name","last_checkin_status" FROM ".fleet-agents-7" ORDER BY "local_metadata.host.name"
  """,
  "fetch_size": "10000"
}

```

This returns a CSV with a column with the hostname and other with the last checkin status.

To know which fields are available you could get information about any agent just to see the fields that are returned.

```auto
GET kbn:/api/fleet/agents/any-agent-id

```

Unfortunately the Agent Management page lacks a lot of information, we opened a couple of enhancement requests with Elastic, but still didn't get feedback, one thing that we are doing is to use the Fleet API to get agent information and create a custom index in Elasticsearch which this data, so we can have a better view and control of our agents.

Do you have more than 10k agents? If you have more than 10k agents you will need to use some WHERE clauses in the SQL query because the fleet API does not return more than 10k agents and also does not paginate.

---

<div class="post-metadata">

**Author:** ![kpollich](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kpollich/32/93788_2.png) [@kpollich](https://discuss.elastic.co/u/kpollich)\
**Post date:** [February 19, 2025, 2:43pm UTC](https://discuss.elastic.co/t/fleet-agent-cannot-export-to-csv/374752/5 "2025-02-19T14:43:19Z")

</div>

> Do you have more than 10k agents? If you have more than 10k agents you will need to use some WHERE clauses in the SQL query because the fleet API does not return more than 10k agents and also does not paginate.

We are taking a look at adding point-in-time query support to the agents API to solve the 10k problem some time in 9.0. See [[Fleet] List agents API should support more than 10k results · Issue #206924 · elastic/kibana · GitHub](https://github.com/elastic/kibana/issues/206924).

This blocks other use cases too like executing an osquery operation across more than 10k agents, so it's high on our list to address.
