Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

Pehapkari.cz:
How to connect ELK with Monolog
Oct 23, 2017 @ 15:48:59

On the Pehapkari.cz blog there's a new tutorial posted showing you how to integrate ELK and Monolog for simpler to use and more robust log handling.

ELK is awesome stack for logging. Monolog is awesome PHP logging library. Let's make them work together. [...] In a nutshell, Monolog offers you a logger, where you send your logs. This logger has multiple handlers, which send these logs wherever you need them. Monolog has many handlers, which enable you to to simply send logs to many destinations, e.g. files, e-mails, slack, logstash, and many more. [...] ELK stack (now known as Elastic stack) stands for Elasticsearch, Logstash, Kibana stack.

After briefly introducing both technologies the author then gets into the integration, showing how to use either the ElasticSearchHandler or Gelf to ship the logs over for handling. Monolong includes the handler to make this work and the post includes the code/configuration to use it. With the logs being sent out the next step is to set up where you're sending them to. In this case it's a RabbitMQ setup that will then send them along to Logstash. Configuration for this is included as well.

tagged: elk logstash elasticsearch kibana tutorial monolog package integration

Link: https://pehapkari.cz/blog/2017/10/22/connecting-monolog-with-ELK/

SitePoint PHP Blog:
Sending PHP Event Messages to Remote Logstash on Windows
Dec 05, 2016 @ 18:20:09

The SitePoint PHP blog has a recently posted tutorial showing you how to send event messages from PHP to a remote Logstash server running your PHP on a system with Windows installed. Logstash's goal is to centralize the logging in your environment, allowing you to input log information from a wide range of sources and stored in an Elasticsearch database.

By opening this article you’ve endeavored yourself to expanding your knowledge of PHP applications as part of event-based distributed systems. You’ll be given a quick intro into what we are referring to when we say event messages, what Logstash is, and why it is so cool.

If you’ve already heard of Beats or understand you can run Logstash locally to ship logs to another Logstash instance or directly to a datastore such as Elasticsearch, this article is still for you and will show you an easy-to-configure-and-run, hopefully more effective and certainly fun-to-use alternative.

They start with the quick introduction to Logstash and how the event handling they'll add in later will relay messages over to the waiting server. A code example is included showing how to manually write to rsyslog, pointing out that it and Logstash use a similar protocol to receive messages. The tutorial then shows how to view the messages in the log to ensure they're making it correctly and how to use this agent to stream messages over to the waiting server.

tagged: sitepoint event messages remote logstash windows agent tutorial

Link: https://www.sitepoint.com/sending-php-event-messages-to-remote-logstash-on-windows/

SitePoint PHP Blog:
Monitoring WordPress Apps with the ELK Stack
Jun 13, 2016 @ 18:21:25

On the SitePoint PHP blog there's a new tutorial from Daniel Berman showing you how to use the ELK stack to monitor WordPress applications, a combination of Elastic Search, Logstash and Kibana. You can find out about setting this stack up in this previous tutorial.

When something does go wrong, one of the first things you’re going to want to look at are the log files. Not because you enjoy it — log files are not easy to decipher — but because they contain valuable information that can shed light on what exactly occurred.

While [you can use the WP Log Viewer], analyzing WordPress and PHP logs is simply not enough. There are also web server and database logs to sift through. To successfully query huge volumes of log messages coming in from various sources and identify correlations, a more solid solution is required.

Enter the ELK Stack.

He shows how to enable the logging features in your WordPress application (in the wp-config file) and ensure they're not output to the users of your site. He then shows you how to install Filebeat to ship the logs over to the ELK stack. He switches over to the ELK side and shows the configuration needed on Logstash to properly handle the WordPress log format. The remainder of the post helps you get started analyzing the log results and limit it down to only what you need via the Kibana query syntax.

tagged: elk stack monitor wordpress elasticsearch kibana logstash tutorial query

Link: https://www.sitepoint.com/monitoring-wordpress-apps-with-the-elk-stack/

SitePoint PHP Blog:
How Can the ELK Stack Be Used to Monitor PHP Apps?
May 12, 2016 @ 15:42:36

The SitePoint blog has posted a new tutorial from author Daniel Berman about using the ELK stack to monitor PHP applications. The ELK stack is made up of Elasticsearch, Logstash and Kibana to make for effective log storage and searching.

A modern web application environment consists of multiple log sources, which collectively output thousands of log lines written in unintelligible machine language. If you, for example, have a LAMP stack set up, then you have PHP, Apache, and MySQL logs to go through. Add system and environment logs into the fray — together with framework-specific logs such as Laravel logs — and you end up with an endless pile of machine data.

Talk about a needle in a haystack. [...] The ELK Stack (Elasticsearch, Logstash, and Kibana) is quickly becoming the most popular way to handle this challenge. Already the most popular open-source log analysis platform — with 500,000 downloads a month, according to Elastic — ELK is a great way to centralize logs from multiple sources, identify correlations, and perform deep-data analysis.

They walk you through the full installation of all three tools starting with Java (they all require it) followed by instructions for each piece. Once they're all up and running (and playing nice together) they help you configure it to pull in Apache access logs and search on the results. They then populate it with quite a bit more sample data and share some basic tips on searching using the custom searching "language". Finally they talk about the visualizations Kibana offers complete with an example showing browser percentages from users of the site.

tagged: elk stack tutorial monitor elasticsearch logstash kibana setup configure apache log

Link: http://www.sitepoint.com/how-can-the-elk-stack-be-used-to-monitor-php-apps/


Trending Topics: