Newbie here, trying to make Graylog work on my simple local dev machine. I find that I can access the Graylog web UI and see a single message sent via command line Curl, but messages sent from my PHP code don’t seem to appear.
For example, this command line succeeds and I see the message in Graylog:
curl -XPOST http://127.0.0.1:12201/graylog -p0 -d '{"short_message":"Hello there", "host":"example.org", "facility":"test", "_foo":"bar"}'
However, this code also completes (I have stepped through the code in VSCode and seen an ‘ok’ response from the curl request made by the GELF PHP code), yet I don’t see the message in Graylog:
$gelfPublisher = new Gelf\Publisher( new Gelf\Transport\TcpTransport('127.0.0.1',12201) );
$message = new Gelf\Message();
$message->setShortMessage("It works in TCP!")
->setLevel(\Psr\Log\LogLevel::ALERT)
->setFullMessage("There was a foo in bar")
;
$gelfPublisher->publish($message);
Still the graylog web UI shows a single log message ‘Hello there’ and none of the ‘It works in TCP!’ ones.
I’ve been through the basic Installation guide for CentOS (close enough to my Fedora system), so I now have the following packages installed:
graylog-server-4.2.8-1.noarch
elasticsearch-oss-7.10.2-1.x86_64
mongodb-org-server-4.4.4-1.el8.x86_64
I’ve followed the required installation steps such as defining password_secret and root_password_sha2 in /etc/graylog/server/server.conf and cluster.name and action.auto_create_index in /etc/elasticsearch/elasticsearch.yml.
The logs in /var/log/graylog-server/server.log and /var/log/elasticsearch/graylog.log show up to date log lines and no errors. Restarting the services with systemctl restart graylog-server.service
and systemctl restart elasticsearch.service
doesn’t seem to help.
I’ve read that the log data is stored in elasticsearch, but I don’t have personal knowledge of this software. I know mongod and can connect to it and query it but it just holds config. What’s a simple way I can connect to my elasticsearch service and query all logs (it’s very minimal at this point, just a “select *” kind of query would help), or other debugging steps I can take?