Custom field formatter in production

Hi everyone,
i followed these instructions to create a custom field formatter:
Writing Custom Field Formatters for Kibana
now in development environment i have my custom field as i wanted.
How can i port these customization in my production environment?
The folder tree is completely different and there is no trace of register.js, so where i have tu put my custom field file and where i register it?

Are you running the same version of KB on both?

Yes, 4.1 for both, i pulled down the development environmente here:
github
i selected 4.1 branch, and the production environment here:
kibana

So you built your dev environment from the source?

yes, as explained in the guide, with npm and grunt

Then you probably want to do the exact same thing for prod.

I don't know the details of why this is different though, maybe one of the devs will stop by.

it is completely different the folder tree, i don't know where i have to put my new file and there is no trace of register.js , the file where i put a string with the declaration of new field.
is there a way to resolve this problem?

If you built your Kibana on dev (with included changes) .... there should be a "target" subdirectory in your kibana directory.
You should be able to deploy that package to production.

*You cant make changes directly to the production environment - neither should you try. The packages in the target directory will have your changes baked in.

there no "target" folder in my tree folder, how can i solve it?

If you say you used grunt to build your dev environment , but have no "target" directory , I assume you just used

grunt dev

to run your changes in "dev mode".

Once you are happy that everything works , you should run

grunt build

or force it (I initially had trouble with the phantomJS testing) with

grunt --force build

It worked perfectly! Thank you very much!

Great :slight_smile:

Now that you are on a custom build , you just need to be careful with new versions of Kibana. You'll have to pull and merge the changes to dev first ,buid it , test it and then deploy to production again.

ok, thank you again!

sorry again, do you think that is possible to merge two fields?
i need to take a field value and merge it in a url with another field.
To be clear:
http://www.example.com/[field1]/[field2]
is there a way to do that?
thank you in advance

Once you start changing the code anything is possible :slight_smile: ... but probably not with a simple custom formatter, as its called on a specific field value.

I would imagine you're better off storing the combination of the two fields in a new joined field - which you can then apply your custom formatter on, in which you can split the value up and do what you please with it.

Maybe have a look at the copy_to mapping option.

Hi Piebuo,

I was wondering if you could help me with adding a new field formatter. I am trying to create a custom field formatter to highlight desired string values. I followed the example for Writing Custom Field Formatters for Kibana. However, I am not able to see the new field option in the drop down. I created Highlight.js and Highlight.html as shown in the example and added my new format to the registry file. I reloaded the Kibana page. What have I missed? I am new to Kibana and I am sure I missed something very simple. Any help is greatly appreciated. Thank you!

Please start a new thread, this one is pretty old and things do change :slight_smile: