Custom field formatter in production


(Pierluigi Buongiorno) #1

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?


(Mark Walkom) #2

Are you running the same version of KB on both?


(Pierluigi Buongiorno) #3

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


(Mark Walkom) #4

So you built your dev environment from the source?


(Pierluigi Buongiorno) #5

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


(Mark Walkom) #6

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.


(Pierluigi Buongiorno) #7

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?


(Pieter Agenbag) #8

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.


(Pierluigi Buongiorno) #9

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


(Pieter Agenbag) #10

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

(Pierluigi Buongiorno) #11

It worked perfectly! Thank you very much!


(Pieter Agenbag) #12

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.


(Pierluigi Buongiorno) #13

ok, thank you again!


(Pierluigi Buongiorno) #14

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


(Pieter Agenbag) #15

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.


(Leah) #16

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!


(Mark Walkom) #17

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


(system) #18