Inspect Developer Log

The Developer Logs command line tool provides an easy and comfortable way to access detailed log information on various events and actions happening in your application when interacting with Kii Cloud. This will help you to analyze directly and profile usage of your application with Kii Cloud much faster.

Installation

Please read here to learn how to install the command line tool.

Usage

The Developer Log command line tool can be launched from the Terminal with the following command.

node bin/kii-logs.js -t \
  --site us \
  --app-id <your_app_id> \
  --app-key <your_app_key> \
  --client-id <your_client_id> \
  --client-secret <your_client_secret>

Accepted parameters are:

  • -h, --help: Display help screen.
  • --app-id: AppID of the application, whose log data should be accessed
  • --app-key: AppKey of the application.
  • --client-id: ClientID for the application.
  • --client-secret: ClientSecret of the application.
  • --token: The token to be used. Can be used instead of client-id and client-secret to re-use an existing token
  • -t, --tail: Stay idle and display the last logs. Also leaves the session open for realtime logs to stream in.
  • -n, --num: Log history limits. You can fetch up to 1500 lines. The default value is 100. The option is ignored if used with -t. If the datetime filter is not specified, show the specified number of the latest logs.
  • --site: specify the server location of the application. This can be either us, jp, cn3, sg, or eu.
  • --use-utc: Use UTC time format for timestamps in output and in date-from and date-to parameters. If not set, the local time will be used.
  • --http-proxy: Specify HTTP proxy, in case the client is running behind a firewall or cannot access directly to Kii Cloud API. Eg: https://my.proxy:8080

Required parameters are --site, --app-id, --app-key, --client-id or -- client-secret. You can get the required data for authentication from the developer portal site of your application (please read here for more information).

However, if the parameter --token is passed into the application instead, ClientID and ClientSecret will not be necessary anymore. For detailed information on how to redeem an administrator token for your application, please make sure to take a look at Admin Features.

Here is the sample output. The timestamps in the log are in ISO 8601 format.

2014-04-09T10:36:00.215+09:00 [INFO] group.create description:New Group created groupID:Lannisters
2014-04-09T10:36:10.837+09:00 [INFO] user.register description:New user registered userID:114ebed2-08f7-4168-b916-ac5f6bf236c3 login-name:Cersei
2014-04-09T10:36:11.081+09:00 [DEBUG] user.login description:User logged in userID:114ebed2-08f7-4168-b916-ac5f6bf236c3 login-name:Cersei
2014-04-09T10:36:11.934+09:00 [INFO] bucket.user.object.create description:Bucket Object created userID:114ebed2-08f7-4168-b916-ac5f6bf236c3 bucketID:Joffrey bucket-type:rw objectID:17c92e3a-39d2-458b-9c29-64d228ff40e5 data-type:application/json; charset=UTF-8
2014-04-09T10:36:12.778+09:00 [DEBUG] bucket.user.acl.grant description:Granted ACL on Bucket userID:114ebed2-08f7-4168-b916-ac5f6bf236c3 bucketID:Joffrey bucket-type:rw verb:Q type:BUCKET
2014-04-09T10:36:12.899+09:00 [DEBUG] bucket.user.acl.grant description:Granted ACL on Bucket userID:114ebed2-08f7-4168-b916-ac5f6bf236c3 bucketID:Joffrey bucket-type:rw verb:C type:BUCKET
2014-04-09T11:45:46.000+09:00 [INFO] user.register description:New user registered userID:caa16ea6-151d-4df9-9fc7-d9c3ce1b90d9 login-name:Jaime

Apply Filter

To only see the log entries that you are currently interested in, you can apply various filters to the Developer Log tool to query for specific records.

  • --user-id: Filtering log, If you only want to fetch logs with a certain user
  • --level: Filtering log, If you only want to fetch logs with a certain level. Eg: DEBUG, INFO, ERROR
  • --date-from: Filtering log, If you only want to fetch logs with a specified date. Eg: 2014-01-01, 2014-01-01 14:05:30
  • --date-to: Filtering log, If you only want to fetch logs with a specified date. Eg: 2014-01-31, 2014-01-31 14:05:30

The date is to be specified either in ISO 8601 format or in YYYY-MM-DD HH:mm:ss format. If the flag --use-utc is specified on the command line, the values of --date-from and --date-to will be interpreted in UTC time.

node bin/kii-logs.js \
  --site us \
  --user-id f9609a8e-d379-4106-af1b-2e2f092991f2 \
  --level INFO \
  --use-utc \
  --date-from 2014-01-01 \
  --date-to 2014-01-31 \
  --app-id <your_app_id> \
  --app-key <your_app_key> \
  --client-id <your_client_id> \
  --client-secret <your_client_secret>

Output

The tool will output the following events:

  • User register, create, update, delete, email/phone-number verification, third-party integration
  • Group create, update, adding member(s), removing member(s), delete
  • Bucket create, delete, update, query
  • Bucket object create, update, delete
  • Bucket object body
    • upload complete
    • upload cancel
    • publish
  • ACL grant, revoke on
    • app (CR: Create new buckets, CT: create new topics)
    • bucket (C: create objects, Q: query, D: drop bucket)
    • bucket objects (R: read, W: write)
    • topic (ST: subscribe to a topic, MT: send messages to a topic)
  • Push installation, bucket/topic subscription, send
  • Server code installation, update, execution
  • Server code internal log statements via console.log

Size of Developer Log

Kii Cloud saves up to 16 MB developer logs per application. This corresponds to about 50,000 lines (the actual number depends on the log contents).

If the size exceeds this limit, old logs will be deleted.