Post new message via RestAPI with Python

Hello && Welcome back

I would like to state I’m not good at Python scripting yet, I just get by :slight_smile: . Some greater details on your environment would be appreciated. The only thing I can do for you is give some suggestion about your network.

As for these errors, I’m quite sure you know what they mean but for an over all view it helps to understand what going on in your network.

  • 400 Bad Request
    The request could not be understood by the server due to malformed syntax. The client SHOULD NOT repeat the request without modifications.

  • 404 Not Found
    The server has not found anything matching the Request-URI. No indication is given of whether the condition is temporary or permanent. The 410 (Gone) status code SHOULD be used if the server knows, through some internally configurable mechanism, that an old resource is permanently unavailable and has no forwarding address. This status code is commonly used when the server does not wish to reveal exactly why the request has been refused, or when no other response is applicable.

  • 415 Unsupported Media Type
    The server is refusing to service the request because the entity of the request is in a format not supported by the requested resource for the requested method.

NOTE: If your trying to use the API from a remote device to your graylog server it would be best that all devices have a static IP Address other then a loop back address. This way you’ll miss a lot of issues in the future. Making sure the correct network ports are opened and not being blocked. A good way is to execute a TCPDUMP on graylog. For example here are a couple commands I personally like to use.

tcpdump -i eth0
tcpdump host 1.1.1.1

OR

tcpdump src 1.1.1.1
tcpdump dst 1.0.0.1

tcpdump -c 1 -X icmp
tcpdump port 3389
tcpdump portrange 21-23

For a better understanding what the community will need to help you, help us. Please take a look here.

Hope that helps