Failed to parse JSON response: json: cannot unmarshal string into Go struct field .Version of type struct { Number string }]

How to solve this error?

Exiting: Couldn't connect to any of the configured Elasticsearch hosts. Errors: [Error connection to Elasticsearch http://localhost:9600: Failed to parse JSON response: json: cannot unmarshal string into Go struct field .Version of type struct { Number string }]

Logstash logs

Hello People , please help to to solve this problem. i have error in Start filebeat in logstash logs.

Step to install and configure filebeat with logstash

Do you have the Elasticsearch HTTP port mapped to 9600 instead of the default 9200?

1 Like

I get error when i install file-beat and use this command ..

Start Filebeat

The setup command loads the Kibana dashboards. If the dashboards are already set up, omit this command.

./filebeat setup
./filebeat -e
> ```

I do not see how that answers my question.

What does your Elasticsearch and Filebeat configuration look like?

Filebeat.yml file

Filebeat input

filebeat.inputs:

Each - is an input. Most options can be set at the input level, so

you can use different inputs for various configurations.

Below are the input specific configurations.

  • type: log

    Change to true to enable this input configuration.

    enabled: true

    Paths that should be crawled and fetched. Glob based paths.

    paths:

    • /home/system/Documents/*.log
      #- c:\programdata\elasticsearch\logs*

    Exclude lines. A list of regular expressions to match. It drops the lines that are

    matching any regular expression from the list.

    #exclude_lines: ['^DBG']

    Include lines. A list of regular expressions to match. It exports the lines that are

    matching any regular expression from the list.

    #include_lines: ['^ERR', '^WARN']

    Exclude files. A list of regular expressions to match. Filebeat drops the files that

    are matching any regular expression from the list. By default, no files are dropped.

    #exclude_files: ['.gz$']

    Optional additional fields. These fields can be freely picked

    to add additional information to the crawled log files for filtering

    #fields:

    level: debug

    review: 1

    Multiline options

    Multiline can be used for log messages spanning multiple lines. This is common

    for Java Stack Traces or C-Line Continuation

    The regexp Pattern that has to be matched. The example pattern matches all lines starting with [

    #multiline.pattern: ^[

    Defines if the pattern set under pattern should be negated or not. Default is false.

    #multiline.negate: false

    Match can be set to "after" or "before". It is used to define if lines should be append to a pattern

    that was (not) matched before or after or as long as a pattern is not matched based on negate.

    Note: After is the equivalent to previous and before is the equivalent to to next in Logstash

    #multiline.match: after

#============================= Filebeat modules ===============================

filebeat.config.modules:

Glob pattern for configuration loading

path: ${path.config}/modules.d/*.yml

Set to true to enable config reloading

reload.enabled: true

Period on which files under path should be checked for changes

#reload.period: 10s

#==================== Elasticsearch template setting ==========================

setup.template.settings:
index.number_of_shards: 3
#index.codec: best_compression
#_source.enabled: false

Starting with Beats version 6.0.0, the dashboards are loaded via the Kibana API.

This requires a Kibana endpoint configuration.

setup.kibana:

Kibana Host

Scheme and port can be left out and will be set to the default (http and 5601)

In case you specify and additional path, the scheme is required: http://localhost:5601/path

IPv6 addresses should always be defined as: https://[2001:db8::1]:5601

#host: "localhost:5601"

Kibana Space ID

ID of the Kibana Space into which the dashboards should be loaded. By default,

the Default Space will be used.

#space.id:

#================================ Outputs =====================================

Configure what output to use when sending the data collected by the beat.

#-------------------------- Elasticsearch output ------------------------------
output.elasticsearch:
hosts: ["localhost:9200"]
username: "system"
password: "<123>"
setup.kibana:
host: "localhost:5601"

#----------------------------- Logstash output --------------------------------
output.logstash:

The Logstash hosts

hosts: ["localhost:5044"]

Optional SSL. By default is off.

List of root certificates for HTTPS server verifications

#ssl.certificate_authorities: ["/etc/pki/root/ca.pem"]

Certificate for SSL client authentication

#ssl.certificate: "/etc/pki/client/cert.pem"

Client Certificate Key

#ssl.key: "/etc/pki/client/cert.key"

Can you please format the configs using the </> tool available in the UI? It is very hard to read as it is now...

output.elasticsearch:
  hosts: ["localhost:9200"]
  username: "system"
  password: "<123>"
setup.kibana:
  host: "localhost:5601"

Hello,
when i start filebeat using logstash logs

with help of step to install filebeat in logstash

but i have error in step 4 and error is

2019-01-08 16:52:37.678120778 +0530 IST m=+39.155193105 write error: failed to open new file: open /var/log/filebeat/filebeat: permission denied
2019-01-08 16:52:37.678486371 +0530 IST m=+39.155558670 write error: failed to open new file: open /var/log/filebeat/filebeat: permission denied
Exiting: Couldn't connect to any of the configured Elasticsearch hosts. Errors: [Error connection to Elasticsearch http://localhost:9600: Failed to parse JSON response: json: cannot unmarshal string into Go struct field .Version of type struct { Number string }]

will you help me to solve this problem

and i am using vm and os is ubantu.

Where is this port 9600 configured??

#================================ Outputs =====================================

Configure what output to use when sending the data collected by the beat.

#-------------------------- Elasticsearch output ------------------------------
output.elasticsearch:
hosts: ["localhost:9600"]
username: "system"
password: "<123>"
setup.kibana:
host: "[localhost:5601]"

when i change 9600 to 9200 in elasticsearch then i get this output..

system@system-VirtualBox:~/filebeat-6.5.4-darwin-x86_64$ filebeat setup
2019-01-08 17:09:47.667809815 +0530 IST m=+0.166213346 write error: failed to open new file: open /var/log/filebeat/filebeat: permission denied
2019-01-08 17:09:47.6682287 +0530 IST m=+0.166632209 write error: failed to open new file: open /var/log/filebeat/filebeat: permission denied
2019-01-08 17:09:47.669199025 +0530 IST m=+0.167602647 write error: failed to open new file: open /var/log/filebeat/filebeat: permission denied
2019-01-08 17:09:47.669454456 +0530 IST m=+0.167857940 write error: failed to open new file: open /var/log/filebeat/filebeat: permission denied
2019-01-08 17:09:47.669594992 +0530 IST m=+0.167998501 write error: failed to open new file: open /var/log/filebeat/filebeat: permission denied
2019-01-08 17:09:47.672454902 +0530 IST m=+0.170858409 write error: failed to open new file: open /var/log/filebeat/filebeat: permission denied
2019-01-08 17:09:47.673344964 +0530 IST m=+0.171748487 write error: failed to open new file: open /var/log/filebeat/filebeat: permission denied
2019-01-08 17:09:47.673409843 +0530 IST m=+0.171813325 write error: failed to open new file: open /var/log/filebeat/filebeat: permission denied
2019-01-08 17:09:50.675224024 +0530 IST m=+3.173627583 write error: failed to open new file: open /var/log/filebeat/filebeat: permission denied
2019-01-08 17:09:50.678035523 +0530 IST m=+3.176439082 write error: failed to open new file: open /var/log/filebeat/filebeat: permission denied
2019-01-08 17:09:50.698629063 +0530 IST m=+3.197032595 write error: failed to open new file: open /var/log/filebeat/filebeat: permission denied
2019-01-08 17:09:50.702569341 +0530 IST m=+3.200972865 write error: failed to open new file: open /var/log/filebeat/filebeat: permission denied
2019-01-08 17:09:51.121498893 +0530 IST m=+3.619902420 write error: failed to open new file: open /var/log/filebeat/filebeat: permission denied
2019-01-08 17:09:51.494875002 +0530 IST m=+3.993278428 write error: failed to open new file: open /var/log/filebeat/filebeat: permission denied
Loaded index template
Loading dashboards (Kibana must be running and reachable)
2019-01-08 17:09:51.495161457 +0530 IST m=+3.993564881 write error: failed to open new file: open /var/log/filebeat/filebeat: permission denied
2019-01-08 17:09:51.496297035 +0530 IST m=+3.994700467 write error: failed to open new file: open /var/log/filebeat/filebeat: permission denied
2019-01-08 17:09:51.496405724 +0530 IST m=+3.994809155 write error: failed to open new file: open /var/log/filebeat/filebeat: permission denied
2019-01-08 17:09:51.496496642 +0530 IST m=+3.994900074 write error: failed to open new file: open /var/log/filebeat/filebeat: permission denied
2019-01-08 17:09:51.496570736 +0530 IST m=+3.994974158 write error: failed to open new file: open /var/log/filebeat/filebeat: permission denied
Exiting: fail to create the Kibana loader: Error creating Kibana client: Error creating Kibana client: fail to get the Kibana version: HTTP GET request to /api/status fails: fail to execute the HTTP GET request: Get http://[localhost:5601]:5601/api/status: lookup localhost:5601: no such host. Response: .

How are you running the components? VirtualBox? Which operating system are you using?

1 Like

open /var/log/filebeat/filebeat: permission denied: You need to run this with sudo on Ubuntu — otherwise the file permissions are wrong as you can see in this error message.

1 Like

in vm - ubantu 16.04LTS

will you share me that command.

  1. To fix the file permission errors you need to run sudo filebeat setup instead of just filebeat setup.
  2. Is Kibana running on localhost? fail to execute the HTTP GET request: Get http://[localhost:5601]:5601/api/status: lookup localhost:5601: no such host. is probably the next thing you will need to fix.
1 Like

Thanks for given time my error solve now.

thanks for given time my error solve now.

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