The sloppy logs
command allows you to print the standard output (stdout) and standard error (stderr) streams for a specific app (container) or a whole project with multiple apps (containers).
Logs for a single application
If you want to display the logs for a specific app within one of your projects, just append the application’s path as an argument to the sloppy logs
command, like this:
$ sloppy logs MyProjectName/MyServiceName/MyApplicationName
Here is an example output for an app’s stdout log:
$ sloppy logs myproject/frontend/apache
2015-07-22 15:28:17 myproject frontend apache 87.139.245.45 - - [22/Jul/2015:13:27:06 +0000] "GET / HTTP/1.1" 200 412 "-" "Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/43.0.2357.134 Safari/537.36"
2015-07-22 15:29:07 myproject frontend apache 87.139.245.45 - - [22/Jul/2015:13:28:00 +0000] "GET /dfdf HTTP/1.1" 404 286 "-" "Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/43.0.2357.134 Safari/537.36"
What does this information tell you?
The first part of the log indicates, which app it has been retrieved from. In our example it has been generated by a project named “my project”, consisting of a service named “frontend” that contains an app with the name of “apache”.
2015-07-22 15:28:17 myproject frontend apache ...
The rest of the line is the actual log entry, that has been generated by this specific app:
... 87.139.245.45 - - [22/Jul/2015:13:27:06 +0000] "GET / HTTP/1.1" 200 412 "-" "Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/43.0.2357.134 Safari/537.36"
Logs for a whole project
If you want to display the logs for all the apps included in a specific project, just append the project’s name as an argument to the sloppy logs
command, like this:
$ sloppy logs MyProjectName
Here is an example output for a project’s stdout log:
Logs
$ sloppy logs apache
2015-05-12 11:55:43 apache frontend apache /log/apache2/access.log <==
2015-05-12 11:55:43 apache frontend apache /log/apache2/error.log <==
2015-05-12 11:55:43 apache frontend apache 12 09:54:42 2015] [notice] Apache/2.2.22 (Debian) PHP/5.4.39-0+deb7u2 configured -- resuming normal operations
2015-05-12 11:55:50 apache frontend apache 12 09:54:50 2015] [error] [client 192.168.0.101] PHP Notice: Undefined index: NAME in /app/index.php on line 20
2015-05-12 11:55:50 apache frontend apache /log/apache2/access.log <==
2015-05-12 11:55:50 apache frontend apache 0.101 - - [12/May/2015:09:54:50 +0000] "GET / HTTP/1.1" 200 898 "-" "spray-can/1.3.1"
The timestamp show the local time of the user device.
Externals Loggins Services
You can also have your logs sent to an external service like Papertrails. These provide more options for aggregation and filtering. Learn How in our blog post.