# Need help with metricbeat field update

**URL:** <https://discuss.elastic.co/t/need-help-with-metricbeat-field-update/209382>\
**Category:** Logstash\
**Created:** [November 25, 2019, 9:28pm UTC](https://discuss.elastic.co/t/need-help-with-metricbeat-field-update/209382 "2019-11-25T21:28:42Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jonny\_Reyes](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jonny_reyes/32/45243_2.png) [@Jonny\_Reyes](https://discuss.elastic.co/u/Jonny_Reyes)\
**Post date:** [November 25, 2019, 9:28pm UTC](https://discuss.elastic.co/t/need-help-with-metricbeat-field-update/209382/1 "2019-11-25T21:28:42Z")

</div>

Hi,

I'm trying to replace a string value (process status that has values like running or stopped) but i'm failing. I only want to update "running" as an 1 and "stopped" as a 0.

I've testing with filters like:

```
filter {
  if [system.process.state] == "stopped" {
    mutate { replace => { "system.process.state" => "0" } }
  }
}

```

But always still viewing the string value running or stopped  
thanks,

---

<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:** [November 25, 2019, 9:42pm UTC](https://discuss.elastic.co/t/need-help-with-metricbeat-field-update/209382/2 "2019-11-25T21:42:16Z")

</div>

Do you really have periods in your fieldname, or should that be [system][process][state]?

---

<div class="post-metadata">

**Author:** ![Jonny\_Reyes](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jonny_reyes/32/45243_2.png) [@Jonny\_Reyes](https://discuss.elastic.co/u/Jonny_Reyes)\
**Post date:** [November 26, 2019, 11:09am UTC](https://discuss.elastic.co/t/need-help-with-metricbeat-field-update/209382/3 "2019-11-26T11:09:59Z")

</div>

I'm reading de document finally inserted on elasticsearch, is a json that has this syntax:

```
{
  "_index": "metricbeat-6.5.4-2019.11.26",
  "_type": "doc",
  "_id": "T5UNp24BtRui5WSZ1hDF",
  "_score": 1,
  "_source": {
    "@timestamp": "2019-11-26T09:32:11.390Z",
    "meta": {
      "cloud": {
        "instance_name": "redis",
        "project_id": "production",
        "provider": "gce"
      }
    },
    "metricset": {
      "rtt": 39421,
      "name": "process",
      "module": "system"
    },
    "system": {
      "process": {
        "username": "redis",
        "cwd": "/var/lib/redis",
        "ppid": 1,
        "pgid": 16714,
        "state": "sleeping",
        "memory": {
          "share": 2695168,
          "size": 1971220480,
          "rss": {
            "bytes": 1112805376,
            "pct": 0.1418
          }
        }
      }
    },
    "beat": {
      "hostname": "redis",
      "version": "6.5.4",
      "name": "redis"
    },
    "host": {
      "architecture": "x86_64",
      "os": {
        "family": "debian",
        "codename": "stretch",
        "platform": "debian",
        "version": "9 (stretch)"
      },
      "id": "12ed2528bcc2bad5d928af1067fb84dc",
      "containerized": false,
      "name": "redis"
    }
  }
}

```

And i want to replace the system.process.state that could be running, stopped, etc to an integer value. But i don't know if i have to specifi the [\_source] nor if I have to put the syntax [\_source] [system] [process] [state] OR system.process.state

---

<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:** [November 26, 2019, 1:30pm UTC](https://discuss.elastic.co/t/need-help-with-metricbeat-field-update/209382/4 "2019-11-26T13:30:08Z")

</div>

It is a nested field, so you should use [system] [process] [state] in logstash.

---

<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:** [December 24, 2019, 1:30pm UTC](https://discuss.elastic.co/t/need-help-with-metricbeat-field-update/209382/5 "2019-12-24T13:30:19Z")

</div>

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