This integration enables you to get web access logging from your Sinatra applications in order to monitor:
- Errors logs (4xx codes, 5xx codes)
- Web pages response time
- Number of requests
- Number of bytes exchanged
Install the Agent on the instance that runs your Sinatra application.
The default Sinatra logging feature logs to stdout. Datadog recommends that you use the Rack Common Logger in order to log to a file and in the console.
Here is a configuration example that generate logs in a file and the console. This can be set in the Rack configuration file (
config.ru) or the configuration block for your Sinatra application.
# logging is enabled by default in classic style applications,
# so `enable :logging` is not needed
file = File.new("/var/log/sinatra/access.log", 'a+')
file.sync = true
use Rack::CommonLogger, file
get '/' do
This logger uses the common Apache Access format and generates logs in the following format:
127.0.0.1 - - [15/Jul/2018:17:41:40 +0000] "GET /uptime_status HTTP/1.1" 200 34 0.0004
127.0.0.1 - - [15/Jul/2018 23:40:31] "GET /uptime_status HTTP/1.1" 200 6997 1.8096
Available for Agent versions >6.0
Collecting logs is disabled by default in the Datadog Agent. Enable it in your
datadog.yaml file with:
Add this configuration block to your
sinatra.d/conf.yaml file at the root of your Agent’s configuration directory to start collecting your Sinatra application logs:
- type: file
service parameter values and configure them for your environment.
Restart the Agent