# Unable to understand func Asset in Filebeat modules codebase

**URL:** <https://discuss.elastic.co/t/unable-to-understand-func-asset-in-filebeat-modules-codebase/162549>\
**Category:** Beats\
**Created:** [January 1, 2019, 6:46am UTC](https://discuss.elastic.co/t/unable-to-understand-func-asset-in-filebeat-modules-codebase/162549 "2019-01-01T06:46:49Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![skbly7](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/skbly7/32/36520_2.png) [@skbly7](https://discuss.elastic.co/u/skbly7)\
**Post date:** [January 1, 2019, 6:46am UTC](https://discuss.elastic.co/t/unable-to-understand-func-asset-in-filebeat-modules-codebase/162549/1 "2019-01-01T06:46:49Z")

</div>

Hi,  
Possible noob question as I am newbie to Beats codebase.

I was trying to go through source code and understand how FileBeat modules work specifically.  
I came across `func Asset` during the same which I couldn't understand as such.

Can someone share what is it?

Referece:

> <https://github.com/elastic/beats/blob/master/filebeat/module/elasticsearch/fields.go#L34>

  

> <https://github.com/elastic/beats/blob/master/filebeat/module/haproxy/fields.go#L34>

---

<div class="post-metadata">

**Author:** ![kvch](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kvch/32/72058_2.png) [@kvch](https://discuss.elastic.co/u/kvch)\
**Post date:** [January 3, 2019, 8:33am UTC](https://discuss.elastic.co/t/unable-to-understand-func-asset-in-filebeat-modules-codebase/162549/2 "2019-01-03T08:33:19Z")

</div>

All Filebeat modules and Beats have a fields.yml file which contains information on its fields. E.g description of the field, type and example value. When `make update` is ran, all fields.yml files are collected and compressed in zlib format and base64 encoded into one long string. This way fields are part of the binary and not shipped as a separate file. So in a nutshell the long string you see is the compressed version of field information of a module or a Beat.

---

<div class="post-metadata">

**Author:** ![kvch](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kvch/32/72058_2.png) [@kvch](https://discuss.elastic.co/u/kvch)\
**Post date:** [January 3, 2019, 8:34am UTC](https://discuss.elastic.co/t/unable-to-understand-func-asset-in-filebeat-modules-codebase/162549/3 "2019-01-03T08:34:42Z")

</div>

You can see how the transformation works here: [https://github.com/elastic/beats/blob/master/libbeat/asset/registry.go](https://github.com/elastic/beats/blob/master/libbeat/asset/registry.go)

---

<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:** [January 31, 2019, 10:34am UTC](https://discuss.elastic.co/t/unable-to-understand-func-asset-in-filebeat-modules-codebase/162549/4 "2019-01-31T10:34:51Z")

</div>

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