logs

boxfuseLogs

Display the console logs of an Instance running either on your machine or on AWS.

Usage: gradle boxfuseLogs -Dboxfuse.instances=instance

> gradle boxfuseLogs -Dboxfuse.instances=vb-b100efe1

init started: BusyBox v1.22.1 (2014-05-18 17:19:42 UTC)
starting pid 522, tty '': '/etc/init.d/rcS'
udhcpc (v1.22.1) started
Setting IP address 0.0.0.0 on eth0
Sending discover...
Sending select for 10.0.2.15...
Lease of 10.0.2.15 obtained, lease time 86400
Setting IP address 10.0.2.15 on eth0
ifconfig: bad address '+'
Adding router 10.0.2.2
Adding DNS server 192.168.0.1
sh: busybox: unknown operand

******************************************************************************

boxfuse is in the house!

Payload
-------
Name        : hello-1.0.war
Type        : War
Checksum    : 41419a8b

Image
-----
Id          : ba-f941bab99ce44830afaf06868496c83d
Coordinates : axelfontaine/hello:1.0
Debug       : false
Strace      : false
Ports       : http -> 80

Instance
--------
Id          : vb-b100efe1
IP Address  : 10.0.2.15
JVM Heap    : 795M

Environment
-----------
BOOT_IMAGE=efi/boot/bootx64.efi
BOXFUSE_COMPONENTS_BUSYBOX=1.22.1
BOXFUSE_COMPONENTS_CACERTS=2014.04.08
BOXFUSE_COMPONENTS_GLIBC=2.20
BOXFUSE_COMPONENTS_LINUX=3.15.9
BOXFUSE_COMPONENTS_OPENJDK=8.20.26
BOXFUSE_COMPONENTS_TOMCAT=8.0.9
BOXFUSE_HOST_IP=192.168.0.12
BOXFUSE_IMAGE_APP=hello
BOXFUSE_IMAGE_ID=ba-f941bab99ce44830afaf06868496c83d
BOXFUSE_IMAGE_OWNER=axelfontaine
BOXFUSE_IMAGE_VERSION=1.0
BOXFUSE_INSTANCE_ID=vb-b100efe1
BOXFUSE_INSTANCE_IP=10.0.2.15
BOXFUSE_PAYLOAD_NAME=hello-1.0.war
BOXFUSE_PLATFORM_ID=virtualbox
BOXFUSE_PLATFORM_NAME=VirtualBox
BOXFUSE_VERSION=1.0.2.546
HOME=/
LD_LIBRARY_PATH=/lib/x86_64-linux-gnu
PATH=/sbin:/bin
PWD=/
SHELL=/bin/sh
TERM=vt102
USER=root
initrd=initrd.gz
vga=extended

******************************************************************************

Launching App ...
/openjdk/bin/java -d64 -Xms10m -Xmx795m -Djavax.net.ssl.trustStore=/cacerts/cacerts -Djava.awt.headless=true -Djava.security.egd=file:/dev/./urandom -Djdk.reflect.allowGetCallerClass=true -cp "/tomcat/bin/*" org.apache.catalina.startup.Bootstrap
Mar 03, 2015 8:47:09 PM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["http-nio-80"]
Mar 03, 2015 8:47:09 PM org.apache.tomcat.util.net.NioSelectorPool getSharedSelector
INFO: Using a shared selector for servlet write/read
Mar 03, 2015 8:47:09 PM org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 361 ms
Mar 03, 2015 8:47:09 PM org.apache.catalina.core.StandardService startInternal
INFO: Starting service Catalina
Mar 03, 2015 8:47:09 PM org.apache.catalina.core.StandardEngine startInternal
INFO: Starting Servlet Engine: Apache Tomcat/8.0.9
Mar 03, 2015 8:47:09 PM org.apache.catalina.startup.HostConfig deployWAR
INFO: Deploying web application archive /tomcat/webapps/ROOT.war
HelloServlet: You should see this in the Instance Logs :-)
Mar 03, 2015 8:47:09 PM org.apache.catalina.startup.HostConfig deployWAR
INFO: Deployment of web application archive /tomcat/webapps/ROOT.war has finished in 257 ms
Mar 03, 2015 8:47:09 PM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["http-nio-80"]
Mar 03, 2015 8:47:09 PM org.apache.catalina.startup.Catalina start
INFO: Server startup in 302 ms

Class name

com.boxfuse.client.gradle.task.LogsTask

Properties

Plugin Parameter Gradle/System property Default Description
user boxfuse.user Required - Your CloudCaptain Client user. Also configurable via the BOXFUSE_USER environment variable
secret boxfuse.secret Required - Your CloudCaptain Client secret. Also configurable via the BOXFUSE_SECRET environment variable
env boxfuse.env dev Use the AWS test or prod environments instead of the local dev one
logsBoot boxfuse.logs.boot false Shows the instance boot logs instead of the application logs
logsFilter boxfuse.logs.filter.FILTER

CloudWatch Logs apps only

The filter to apply when viewing the application logs.

Supported filters:

Name Description Example
instance Only show logs for the instance with this id i-12345678
image Only show logs for instances of this CloudCaptain image myuser/myapp:123
app Only show logs for instances of this CloudCaptain app myuser/myapp
level Only show log events at this log level or higher (possible values: TRACE,DEBUG,INFO,WARN,ERROR) WARN
event Only show logs events with this exact event id USER_CREATED
logger Only show logs events with this exact logger com.myapp.MyClass
thread Only show logs events created on this exact thread main
account Only show logs events in relation to this account in the system my-account
action Only show logs events in relation to a domain-specific element in the system (like an customer order for example) order-12345
user Only show logs events in relation to this user of the account (for systems with the concept of teams or multiple users per account) MyUser
session Only show logs events for the session with this id session-9876543210
request Only show logs events for the request with this id req-111222333
message Only show logs events with this message my-log-message
limit Limit output to first n log messages where 1 <= n <= 10000 2500
start Limit output to log messages created after this date and time.

Supported date formats:

  • 2016-12-08 11:22:44
  • 2016-12-08 11:22
  • 2016-12-08
  • 11:22:44
  • 11:22

The space between date and time can also be replaced by the letter T like in standard ISO dates. Example: 2016-12-08T11:22:44

By appending Z to the time it will be treated as UTC instead of local time. Example: 2016-12-08 11:22:44Z

As an alternative to the absolute date/time you also have the option to pass in the relative number of seconds to the current time. Example: -600 (10 minutes ago)

2016-12-07 12:34:56
end Limit output to log messages created before this date and time.

Supported date formats:

  • 2016-12-08 11:22:44
  • 2016-12-08 11:22
  • 2016-12-08
  • 11:22:44
  • 11:22

The space between date and time can also be replaced by the letter T like in standard ISO dates. Example: 2016-12-08T11:22:44

By appending Z to the time it will be treated as UTC instead of local time. Example: 2016-12-08 11:22:44Z

As an alternative to the absolute date/time you also have the option to pass in the relative number of seconds to the current time. Example: -600 (10 minutes ago)

2016-12-08 20:10:00

Wildcards: Wilcard matching is supported by prepending and/or appending an asterisk (*) to the filter value. Examples:

*abc match all ending with abc
abc* match all starting with abc
*abc* match all starting or ending with abc
logsLayout boxfuse.logs.layout timestamp app? image? instance? event? 40:logger? 10:thread? account? action? user? session? request? message?

CloudWatch Logs apps only

The layout to use when displaying the logs.

Format:

  • All fields are separated by a single whitespace and are variable-width by default
  • Appending ? to the field name hides the field if a filter matches it exactly
  • Prepending a number and a column (example: 10:) left trims or left pads the field to that length
  • Appending a number and a column (example: :10) right trims or right pads the field to that length
  • Valid field names: level, timestamp, app, image, instance, event, logger, thread, account, action, user, session, request, message

Example: level:5 image logger?:30 10:thread shows 4 fields:

  • level fixed width of 5, right padded or right trimmed if necessary
  • image variable width
  • logger fixed width of 30, right padded or right trimmed if necessary, hidden if matched exactly in filter
  • thread fixed width of 10, left padded or left trimmed if necessary
logsTail boxfuse.logs.tail false Tail (keep running with live updates) the logs
instances boxfuse.instances The comma-separated list of ids of the Instance to work with

Sample Configuration

boxfuse {
    user='1234567890abcdef1234567890abcdef12345678'
    secret='ABCDEFGHIJKL1234567abcdefghijklmnopqrstu'
    env='prod'
    logsBoot=true
    logsFilter=[
        'account':'MyAccount123',
        'level':'WARN'
    ]
    logsLayout='timestamp app? image? instance? event? 40:logger? account? session? request? message?'
    logsTail=true
    instances='vb-ec717c5e'
}

destroy