# ECS Orgnasisation fields

**URL:** <https://discuss.elastic.co/t/ecs-orgnasisation-fields/180799>\
**Category:** APM\
**Tags:** java, server\
**Created:** [May 13, 2019, 11:39am UTC](https://discuss.elastic.co/t/ecs-orgnasisation-fields/180799 "2019-05-13T11:39:30Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![suikast42](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/suikast42/32/29865_2.png) [@suikast42](https://discuss.elastic.co/u/suikast42)\
**Post date:** [May 13, 2019, 11:39am UTC](https://discuss.elastic.co/t/ecs-orgnasisation-fields/180799/1 "2019-05-13T11:39:30Z")

</div>

Is the organisation field for APM supported ?

[https://www.elastic.co/guide/en/ecs/1.0/ecs-organization.html](https://www.elastic.co/guide/en/ecs/1.0/ecs-organization.html)

I can't find an option in the latest java APM agent.

---

<div class="post-metadata">

**Author:** ![Eyal\_Koren](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/eyal_koren/32/36830_2.png) [@Eyal\_Koren](https://discuss.elastic.co/u/Eyal_Koren)\
**Post date:** [May 13, 2019, 11:59am UTC](https://discuss.elastic.co/t/ecs-orgnasisation-fields/180799/2 "2019-05-13T11:59:59Z")

</div>

Hi again 🙂  
We don't have a way to set those, but can you achieve what you need through the [addLabel API](https://www.elastic.co/guide/en/apm/agent/java/current/public-api.html#api-span-add-tag)?

We intend to add [global labels](https://github.com/elastic/apm-agent-java/issues/507) that will probably be even more suitable for this purpose, but I can't guarantee when this will be added.

I hope this helps,  
Eyal.

---

<div class="post-metadata">

**Author:** ![suikast42](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/suikast42/32/29865_2.png) [@suikast42](https://discuss.elastic.co/u/suikast42)\
**Post date:** [May 13, 2019, 12:04pm UTC](https://discuss.elastic.co/t/ecs-orgnasisation-fields/180799/3 "2019-05-13T12:04:30Z")

</div>

Pity.

That can be very helpful from APM client site if you work on more project.

The label can help but I like the ECS way more. It's a comon trhogh all indicies. I migrate even my log documents to it 😉

---

<div class="post-metadata">

**Author:** ![Eyal\_Koren](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/eyal_koren/32/36830_2.png) [@Eyal\_Koren](https://discuss.elastic.co/u/Eyal_Koren)\
**Post date:** [May 13, 2019, 12:21pm UTC](https://discuss.elastic.co/t/ecs-orgnasisation-fields/180799/4 "2019-05-13T12:21:31Z")

</div>

I see.  
Can you use the [APM server's configuration of ingest node pipelines](https://www.elastic.co/guide/en/apm/server/6.6/configuring-ingest-node.html) to add this field to all events?

---

<div class="post-metadata">

**Author:** ![suikast42](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/suikast42/32/29865_2.png) [@suikast42](https://discuss.elastic.co/u/suikast42)\
**Post date:** [May 13, 2019, 1:10pm UTC](https://discuss.elastic.co/t/ecs-orgnasisation-fields/180799/5 "2019-05-13T13:10:31Z")

</div>

I have already deployed a custom pipeline as plugin for tagging my log entries.  
Sure I can tag use labels and convert them to the oransisation.id.

But what about the mapping in apm-\* index ?

---

<div class="post-metadata">

**Author:** ![Eyal\_Koren](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/eyal_koren/32/36830_2.png) [@Eyal\_Koren](https://discuss.elastic.co/u/Eyal_Koren)\
**Post date:** [May 20, 2019, 11:04am UTC](https://discuss.elastic.co/t/ecs-orgnasisation-fields/180799/6 "2019-05-20T11:04:08Z")

</div>

No need to use labels and convert them.  
Register a pipeline as such:

```auto
{
  "description": "Sets organization info",
  "processors": [
    {
      "set": {
        "field": "organization.name",
        "value": "Elastic"
      }
    },
    {
      "set": {
        "field": "organization.id",
        "value": "68w4rw6"
      }
    }
  ]
}

```

And make sure to update `apm-server.yml` to apply this pipeline during ingestion, as described in the link from my previous post.

Can this work?

---

<div class="post-metadata">

**Author:** ![simitt](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/simitt/32/106406_2.png) [@simitt](https://discuss.elastic.co/u/simitt)\
**Post date:** [May 21, 2019, 10:02am UTC](https://discuss.elastic.co/t/ecs-orgnasisation-fields/180799/7 "2019-05-21T10:02:57Z")

</div>

The `organization.id` and `organization.name` are actually defined as `keyword` in the template. So if you populate the fields yourself, they should be indexed and queryable.

Generally there is an `experimental` config option [setup.template.append\_field](https://www.elastic.co/guide/en/beats/filebeat/6.7/configuration-template.html) you could try out if you want to define additional fields to index.

---

<div class="post-metadata">

**Author:** ![suikast42](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/suikast42/32/29865_2.png) [@suikast42](https://discuss.elastic.co/u/suikast42)\
**Post date:** [May 25, 2019, 1:11pm UTC](https://discuss.elastic.co/t/ecs-orgnasisation-fields/180799/8 "2019-05-25T13:11:59Z")

</div>

I know way creation of pipelines.  
But that's not flexible in my case.  
I am working on mir projects in parallel.  
Can I convert a label filed to organisation name with that approach?

---

<div class="post-metadata">

**Author:** ![Eyal\_Koren](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/eyal_koren/32/36830_2.png) [@Eyal\_Koren](https://discuss.elastic.co/u/Eyal_Koren)\
**Post date:** [May 26, 2019, 7:24am UTC](https://discuss.elastic.co/t/ecs-orgnasisation-fields/180799/9 "2019-05-26T07:24:23Z")

</div>

Yes, you can. For example, if you label spans/transactions with the keys `organization-name` and `organization-id`, you can use this pipeline:

```auto
    "description" : "Sets organization info",
    "processors" : [
      {
        "set" : {
          "field" : "organization.name",
          "value" : "{{labels.organinzation-name}}"
        }
      },
      {
        "set" : {
          "field" : "organization.id",
          "value" : "{{labels.organinzation-id}}"
        }
      }
    ]
  }

```

The syntax `"value" : "{{...}}"` can be used for that.  
Notice that these processors assume stack version \>= 7.0. For lower versions, these labels may be stored under `context.tags.organization-XX` instead, so look it up before you set the pipeline.

---

<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:** [June 16, 2019, 3:24am UTC](https://discuss.elastic.co/t/ecs-orgnasisation-fields/180799/10 "2019-06-16T03:24:27Z")

</div>

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