# Can i build both OSS and x-pack modules for metricbeat

**URL:** <https://discuss.elastic.co/t/can-i-build-both-oss-and-x-pack-modules-for-metricbeat/375891>\
**Category:** Beats\
**Tags:** metricbeat\
**Created:** [March 14, 2025, 6:13am UTC](https://discuss.elastic.co/t/can-i-build-both-oss-and-x-pack-modules-for-metricbeat/375891 "2025-03-14T06:13:56Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![srishti](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/srishti/32/142038_2.png) [@srishti](https://discuss.elastic.co/u/srishti)\
**Post date:** [March 14, 2025, 6:13am UTC](https://discuss.elastic.co/t/can-i-build-both-oss-and-x-pack-modules-for-metricbeat/375891/1 "2025-03-14T06:13:56Z")

</div>

Hello, I'm trying to metricbeat from source and it seems I can build the binary for either the oss modules or x-pack modules.

The binary in the image(elastic/metricbeat:8.17.3) is built for both.

Is that something I can do while building it locally from source?

---

<div class="post-metadata">

**Author:** ![AndersonQ](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/andersonq/32/112214_2.png) [@AndersonQ](https://discuss.elastic.co/u/AndersonQ)\
**Post date:** [March 14, 2025, 3:02pm UTC](https://discuss.elastic.co/t/can-i-build-both-oss-and-x-pack-modules-for-metricbeat/375891/2 "2025-03-14T15:02:14Z")

</div>

Sorry, could you explain better what you're trying ti build?

---

<div class="post-metadata">

**Author:** ![srishti](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/srishti/32/142038_2.png) [@srishti](https://discuss.elastic.co/u/srishti)\
**Post date:** [March 17, 2025, 4:51am UTC](https://discuss.elastic.co/t/can-i-build-both-oss-and-x-pack-modules-for-metricbeat/375891/3 "2025-03-17T04:51:21Z")

</div>

I'm trying to build metricbeat from source. I built it by running `mage build` within `metricbeat` directory.

When I run `metricbeat modules list` I just see the oss modules. When I run the same command within the `elastic/metricbeat:8.17.3` image I see modules from both OSS and x-pack.

---

<div class="post-metadata">

**Author:** ![AndersonQ](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/andersonq/32/112214_2.png) [@AndersonQ](https://discuss.elastic.co/u/AndersonQ)\
**Post date:** [March 17, 2025, 7:32am UTC](https://discuss.elastic.co/t/can-i-build-both-oss-and-x-pack-modules-for-metricbeat/375891/4 "2025-03-17T07:32:12Z")

</div>

The OSS docker image we publish is [docker.elastic.co/beats/metricbeat-oss:8.17.3](http://docker.elastic.co/beats/metricbeat-oss:8.17.3).  
Try this one and you should get only the OSS modules.

---

<div class="post-metadata">

**Author:** ![srishti](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/srishti/32/142038_2.png) [@srishti](https://discuss.elastic.co/u/srishti)\
**Post date:** [March 17, 2025, 8:40am UTC](https://discuss.elastic.co/t/can-i-build-both-oss-and-x-pack-modules-for-metricbeat/375891/5 "2025-03-17T08:40:02Z")

</div>

Thank you, but I'd like to build with both oss and x-pack modules. Is that an option when building metricbeat locally?

---

<div class="post-metadata">

**Author:** ![AndersonQ](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/andersonq/32/112214_2.png) [@AndersonQ](https://discuss.elastic.co/u/AndersonQ)\
**Post date:** [March 19, 2025, 9:26am UTC](https://discuss.elastic.co/t/can-i-build-both-oss-and-x-pack-modules-for-metricbeat/375891/6 "2025-03-19T09:26:17Z")

</div>

Yes, the best way to build them is using `mage package` instead of `build`. `package` will generate the package with all artefacts metricbeat needs.

If you run it from `metricbeat` it'll package the oss version, from `x-pack/metricbeat`, the x-pack version.

Is it what you're looking for? You can also build the docker images
