Websocket input client threw expection

I am using the websocket input plugin of logstash. I am using data from the websocket to be indexed on elastic search. But it throws me a error. I tried some answers on your forum. Eventhough it fails. Help me with some solutions. Tell me the format of data where the web socket accepts...Give me some examples...In the logstash docs, the data format is not there....

This is the input from the websocket. It goes on...

{
  "March 14 2019, 18:51:09": {
    "monitor.status": " UP",
    "monitor.id": "icmp@icmp-ip@192.168.1.66",
    "beat.hostname": "smackcoders",
    "monitor.duration.us": 148709,
    "beat.name": "smackcoders",
    "host.os.codename": "xenial",
    "host.containerised": false,
    "host.os.version": "16.04",
    "host.id": "556b837c93cd4b8dbd3a1c01f468d8f4",
    "a": "steven",
    "icmp.rtt.us": 4300,
    "monitor.ip": "192.168.1.66",
    "host.os.family": "debian",
    "host.architecture": "x86_64",
    "tags": "res1,ip1",
    "monitor.name": "icmp",
    "host.name": "smackcoders",
    "host.os.platform": "",
    "b": "kumar",
    "beat.version": 1.0,
    "icmp.requests": "1"
  },
  "March 14 2019, 18:51:09": {
    "monitor.status": " UP",
    "monitor.id": "icmp@icmp-ip@192.168.1.71",
    "beat.hostname": "smackcoders",
    "monitor.duration.us": 156959,
    "beat.name": "smackcoders",
    "host.os.codename": "xenial",
    "host.containerised": false,
    "host.os.version": "16.04",
    "host.id": "556b837c93cd4b8dbd3a1c01f468d8f4",
    "a": "steven",
    "icmp.rtt.us": 11400,
    "monitor.ip": "192.168.1.71",
    "host.os.family": "debian",
    "host.architecture": "x86_64",
    "tags": "res1,ip1",
    "monitor.name": "icmp",
    "host.name": "smackcoders",
    "host.os.platform": "",
    "b": "kumar",
    "beat.version": 1.0,
    "icmp.requests": "1"
  },
}

Here's the config file of logstash:

input {
websocket {
url => "ws://192.168.1.27:10016"
codec => "json"
}
}
output {
elasticsearch {
hosts => "localhost"
index => "web_socket"
document_type =>"web_apps"
}
stdout{}
}

Error i got:

[WARN ] 2019-06-10 10:35:02.359 [[main]<websocket] websocket - websocket input client threw exception, restarting {:exception=>#<HTTP::Parser::Error: invalid method>}
[WARN ] 2019-06-10 10:35:03.707 [[main]<websocket] websocket - websocket input client threw exception, restarting {:exception=>#<HTTP::Parser::Error: invalid method>}
[WARN ] 2019-06-10 10:35:05.141 [[main]<websocket] websocket - websocket input client threw exception, restarting {:exception=>#<HTTP::Parser::Error: invalid method>}

Your JSON is not valid JSON. It has a trailing , on the last element, preceding the final }

1 Like

Thanks for the reply. I will fix it...

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