I don’t know if you’re familiar with this, but when we were writing the Logstash configuration file, it was sometimes a little inconvenient. Editing a file like logstash. Conf doesn’t feel very convenient compared to the powerful autocomplete editors that are popular today. Luckily for VS Code, there is a plugin called Logstash Editor that makes it easy to edit the Logstash configuration file as well as the Filebeat configuration file. In today’s article, we will briefly introduce. Detailed information about this plug-in can be found at the address.

 

The installation

Let’s start by installing VS Code. It requires a minimum version of 1.52. If your version is too early, install a version that meets the requirements. Open the Code:

Let’s first find the Logstash Editor plug-in and install it:

So our installation is complete.

 

Create the Logstash configuration file

Once installed, we can create a file called logstash. Conf on the command line or in Code:

$ pwd
/Users/liuxg/tmp
$ code logstash.conf
Copy the code

Above, I created a file called logstash. Conf in the TMP directory:

If we press CMD + I at the same time, we can see the autocomplete prompt above. For example, we select INPUT:

We can select input and hover over it to see a prompt. We can even click on the blue section above:

It prompts us to open the official Elastic document and get help:

Doesn’t this all feel very comfortable! It’s a seamless transition. In the input section above, if we don’t know what to type, we can also press CMD + I:

Is happiness too fast! It gives a quick reminder of the input we might have that we can use. Above, we select Elasticsearch as the input:

Similarly, if we don’t know how to proceed, we can use CMD + I again, which will remind us of more options to improve the input setting. If you don’t understand ElasticSearch Input, you can click on the link about it:

This can quickly get help from official documentation. You can also see the reference code for elasticSearch input above.

 

Create the Filebeat profile

Editing Filebeat’s profile can also be challenging for many developers. We’ll do the same for filebeat.yml:

$ pwd
/Users/liuxg/tmp
$ code filebeat.yml
Copy the code

Above, we create a file called filebeat.yml in TMP:

Along the same lines, we can easily create our filebeat.yml file:

I’ll leave the rest to you.

 

Select a different version

Above we can see that version 7.12 is used, which is the latest version. In practical use, we can choose different versions to write:

From above, we can choose different versions to write!