Leading Business Litigation Attorney in Lake Charles

Want to free from your business contract problem? Come to us! Our expert Business Litigation Firm in Lake Charles will analyze your problem completely to give efficient solution. Call (337) 436–0522…

Smartphone

独家优惠奖金 100% 高达 1 BTC + 180 免费旋转




Use Datadog to manage your Logs from a PHP application

Today the management of logs it has become in a challenge for applications that has to handle millions of records. Having logs and analyze them is an important tool when is necessary to solve the occurrences of the errors. We can investigate the origin of the problems searching on logs, because in the logs we will always have a trace of the events that happened in the system. Analyze them can help us to find the solution to many darks issues that sometimes happens in a production enviroment.

Datadog has become is one the most used tools for managing and analice logs , metrics and many more variables on a system. Today we are going to use Datadog for handle the logs produced by a PHP application on a window machine.

Enter your personal data email, name and phone number

You will be redirected to a browser

It is necessary now to download the agent. We will use window but we can install, on docker, over EC2 and in many other environments. The main purpose of this agent is be a link between the source of logs and the Datadog server. While the agent is running our locals logs will be send it to the Datadog server and in there we can access, make query and build views using its data.

In order to download the agent in our datadog web we will going to on the left menu to the option Integrations-> Agent

In this case we will use the version agent for window

When we have finished of install the user agent, our URL assigned will receive the report of an agent and it shows the next picture

Restart the agent

Go again to the agent Datadog browser and press status and check that the Logs Agent is ready

In our app we have to do the necessary things to save our logs into a file. The agent will take that file and send the logs to the Datadog server. In this example the logs file will be saved inside our app in a file named audit.log

Close the agent

Goes to C:\ProgramData\Datadog\conf.d and add the required permissions on window to access the folder conf.d

In order to set up a custom log collection to tail your log files and send new logs to Datadog we have to do the following steps:

As an example in our case the log files will be located on D:\\Project\\PHPApplication\\tmp\\logs\\audit.log

Restart your Agent to take into account this new configuration. Going to check and looking for the key php.d and checks that is shown

Now is time to go to our log files and give it access to read and write to user dduseragent. This user was created by the agent when it was installed and it will access to our log and do the job to send the logs to our Datadog Server

Now that our agent has access to the log file we can go and try to modify the audit.log adding a new entry by using our PHP application.

In the moment when the file changes, the agent takes the logs and send them to the Datadog server.

You can check the send of the data going to our local agent interface pressing on status and locate the Logs Agent, you can see in this case, it has read a number of LogsProcessed: 12

In our Datadog server URL we will try to locate those 12 logs. We will go to Logs -> Search option using the left menu

And we can see in the Logs explorer our logs have been sent

I hope that you have enjoy as I this travel to start to use this wonderful tool Datadog and see you in the next articles ;-)

Add a comment

Related posts:

8 Hints On How To Learn To Enjoy A Family Reunion

We can enjoy the family gatherings because they are parties

possess some knowledge of Hatha Yoga and Other Important Types

One is noway too old to indeed consider going for yoga exercises. There are different feathers of yoga known and every single bone of them is known to help in farther developing good and in general…

Everything is political

I was reading a book, "If I want to change the world" by sociologist Sabrina Fernandes and I came across one of the chapters, which was about class consciousness and neutrality and how neutrality…