Datadog logging setup on ubuntu
We are moving our application logging to Datadog. I write about Papertrail installation and configuration in the past. We are moving our logging to Datadog since all our monitoring is there. So, we can view it all in one place and maintain it.
Actually, it’s quite straightforward to set up. But, as always when you need to set up, it’s time to explore again. Or when someone comes and asks, I have to help check or do a Google search again. So, here I am writing this for myself.
Firstly, you have to install a data dog agent.
And then, enable logs with the following command.
sudo sed -i "/# logs_enabled: false/c\logs_enabled: true" /etc/datadog-agent/datadog.yaml
Then you create a config directory for your log’s. In our case, it’s PHP. So we created the php.d directory. Inside that directory, we create a config.yaml for the log.
sudo mkdir /etc/datadog-agent/conf.d/php.d
sudo vim /etc/datadog-agent/conf.d/php.d/conf.yaml
Update config.yaml base on what you need. In our case, it’s laravel application which is under /var/www/
logs:
- type: file
path: /var/www/laravel/storage/logs/*.log
source: my-web-application
service: wholesale-wsapi
sourcecategory: laravel