However, now I need to start clean with fresh data. I don’t want to loose all my configurations and extractors, so the minimal change I need is to simply delete all messages.
Index time
After some research I see that Graylog does not support deleting individual messages, the smallest unit it understands is an index.
So I need to delete all indexes from GayLog.
After some more research, I found the delete API in elasticsearch, and I tried this command (but it fails):
$ curl -XDELETE 'http://localhost:9000/*'
{"type":"ApiError","message":"HTTP 404 Not Found"}
I use localhost:9000 because that is the port I use to access graylog.
Questions
What am I dong wrong (how can I fix this command so it works as intended)?
Is there an easier way to delete all messages in Graylog?
Fl4m3Ph03n1x
(Pedro Miguel Pereira Serrano Martins)
2
Solution
As it turns out, there were two issues:
the command in the tutorial for the elasticsearch docker does not expose the container’s port
the port I was using (9000) was incorrect, it should be 9200
With this in mind, this is the solution I arrived to:
As you can see, the elastic search command now exposes port 9200. With this in mind the following CURL now works as expected:
curl -XDELETE 'http://localhost:9200/*'
WARNING: After deleting all the indices (and therefore all messages) you need to recalculate the indices. This is another topic that is out of the scope of this question.