As Easy as Falling off a Log (Or Writing to One)
Logging is more than just appending to a file. Logging can be a critical piece of infrastructure that allows reconstructing what happened over disparate systems for security auditing, debugging and error post-mortems. Without it, you’re flying blind.
Starting with plain old error_log(), we move up the food chain to syslog and examine its capacities and limitations. Next, will be an introduction to one of the better open source PHP logging packages—MonoLog. We’ll show how it’s built into Laravel and how to call it from MySQL.
All this is for naught without some way to sort and filter the thousands of logging messages. We’ll demonstrate a modern open-source syslogging package: Graylog. We will demonstrate how to search and sort the messages we created in our PHP apps. We’ll also look at some of the ways Graylog provides to work around the limitations of Syslog using Graylog extractors which are the easiest to use and how to construct easy-to-parse messages in our PHP code.