Redirect a json post request to a gelf input of graylog
1.7K
Just a simple sinatra app that will forward posted json to a gelf input of graylog with basic auth protection. You can run this as container or standalone - or in any cluster.
The most important things can be configured via ENV:
| ENV | description | default |
|---|---|---|
| APP_NAME | will set the app name to the graylog facility | gelf proxy |
| LOG_SERVER | logging server url or ip | |
| LOG_SERVER_PORT | gelf input port | 12201 |
| LOGGER_USERNAME | Username for http auth | gelf |
| LOGGER_PASSWORD | Password for http auth | fleg |
| SUBPATH_URI | subpath on your env | / |
for more details, have a look at lib/constants.rb.
e.g.
curl --header "Content-Type: application/json" \
--request POST \
--data '{"username":"xyz","password":"xyz"}' \
http://gelf:fleg@localhost:4567/log
this will post the json to sinatra and redirect it to graylog.
Sinatras autoreload feature is active, it will reload all *.rb files in /lib (feel free to watch other directories too).
$ bundle install
$ bundle exec rackup config.ru -p 4567
[2020-09-15 08:22:52] INFO WEBrick 1.4.2
[2020-09-15 08:22:52] INFO ruby 2.6.6 (2020-03-31) [x86_64-linux]
[2020-09-15 08:22:52] INFO WEBrick::HTTPServer#start: pid=30080 port=4567
Just fire up docker-compose
docker-compose up
Content type
Image
Digest
Size
330.6 MB
Last updated
over 5 years ago
docker pull loumaris/gelf_proxy