# What is the simplest way to upload a custom metric?

**URL:** <https://discuss.elastic.co/t/what-is-the-simplest-way-to-upload-a-custom-metric/363209>\
**Category:** Elastic Observability\
**Created:** [July 16, 2024, 10:00am UTC](https://discuss.elastic.co/t/what-is-the-simplest-way-to-upload-a-custom-metric/363209 "2024-07-16T10:00:55Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![usernamenotavailable](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/usernamenotavailable/32/136076_2.png) [@usernamenotavailable](https://discuss.elastic.co/u/usernamenotavailable)\
**Post date:** [July 16, 2024, 10:00am UTC](https://discuss.elastic.co/t/what-is-the-simplest-way-to-upload-a-custom-metric/363209/1 "2024-07-16T10:00:55Z")

</div>

I want to upload a custom metric to Elastic Cloud. Every 30 seconds a script will run, call an API, download a zip file, extract it, turn it into JSON, and send it to Elastic Cloud so I can monitor it on a dashboard.

What is the simplest way to do this please? The Elastic Observability docs seem to have only info on existing Integrations, not on how to send your own data to Elastic Cloud.

GPT recommends MetricBeat, which I have to write a custom Go module for, or calling the Elasticsearch API directly. I can't find good documentation or a how-to guide for either. Please advise.

---

<div class="post-metadata">

**Author:** ![usernamenotavailable](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/usernamenotavailable/32/136076_2.png) [@usernamenotavailable](https://discuss.elastic.co/u/usernamenotavailable)\
**Post date:** [July 16, 2024, 10:03am UTC](https://discuss.elastic.co/t/what-is-the-simplest-way-to-upload-a-custom-metric/363209/2 "2024-07-16T10:03:00Z")

</div>

Removed #elastic-cloud

---

<div class="post-metadata">

**Author:** ![usernamenotavailable](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/usernamenotavailable/32/136076_2.png) [@usernamenotavailable](https://discuss.elastic.co/u/usernamenotavailable)\
**Post date:** [July 17, 2024, 1:43pm UTC](https://discuss.elastic.co/t/what-is-the-simplest-way-to-upload-a-custom-metric/363209/3 "2024-07-17T13:43:36Z")

</div>

The easiest way I found is to call the Elasticsearch API directly.

Create an index, where the key is your `encoded` field from your API key:

```sh
export elasticKey="WGdLQ=="
export elasticUrl="https://c301.us-central1.gcp.cloud.es.io:443"
curl -X PUT "${elasticUrl}/falogins" -H "Authorization: ApiKey ${elasticKey}" -H "Content-Type: application/json" -d'
{
  "mappings": {
    "properties": {
      "timestamp": { "type": "date" },
      "value": { "type": "text" }
    }
  }
}'

# Result:
# {"acknowledged":true,"shards_acknowledged":true,"index":"logins"}

```

Upload a value

```auto
curl -X POST "${elasticUrl}/falogins/_doc" -H "Authorization: ApiKey ${elasticKey}" -H "Content-Type: application/json" -d '{ "timestamp": 1721193965740, "value": "bob" }'

```
