Skip to content

Login log

This log is stored by user login. You can check the current status of users who join new games or play games due to promotion.

Category

  • Scribe type
Common Server service_metrics-login_log
Test Server test-login_log
  • FTP type
Naming Rule login_[Date]_[Server]_[ID for avoiding duplication].json e.g., login_20180705_111500_GLOBAL-4.json
  • Fluentd type (Based on Log definition)
Server (Balancing loads to two servers) analytics-hivelog-03.withhive.com analytics-hivelog-04.withhive.com
Rule for naming tag ha2union.game.[short name of game].login_log e.g., ha2union.game.samplegame.login_log
Value of category field [short name of game]_login_log e.g., {"category":"samplegame_login_log","aaa":1}
Detailed transmission method
  • http type (Based on Log definition)
Server https://analytics-log.withhive.com
Value of category field [short name of game]_login_log e.g., {"category":"samplegame_login_log","aaa":1}
Detailed transmission method

Log specification

Note

The snake-cased field, like server_id, is transformed to camel case, like serverId, when it stores in the final storage (BigQuery), and the log sent in the unspecified form, such as serverid, is not saved in its column.

Field Name Description Type Required
date The time storing log
Format: yyyy-mm-dd hh🇲🇲ss
e.g., 2012-01-19 16:24:00
Required for Scribe/FTP type, optional for Fluentd type
string N
dateTime The time storing log
Format: yyyy-mm-dd hh🇲🇲ss
e.g., 2012-01-19 16:24:00
string Y
category [The brand name of game]_[Log name]
The brand name of game is the third item of app_id
e.g., "derbyday_login_log"
string Y
timezone UTC offset of time parameter in the log
Fix the value of timezone as a blank or GMT+09:00 as the value of date is always KST when sending log definition as scribe or ftp type.
e.g., “GMT+09:00”
* Set the value of timezone flexiblely in accordance with the value of dateTime when sending log definition as fluentd or http type.
e.g., “GMT+10:30”
string Y
channel Login channel
C2S: HIVE
KAK: Kakao Talk
LIN: LINE
WEI: Weibo
GVL: Gamevile Live
STE: Steam
string(3) Y
user_id User identifier used with the configured channel field
C2S: vid
KAK: User identifier issued by App Center
LIN: User identifier issued by App Center
WEI: Weibo
bigint Y
app_id AppID which Hive SDK uses
e.g., 'com.com2us.derbyday.kakao.freefull.google.global.android.common'
string(200) Y
did Device ID which Hive SDK uses bigint Y
level User level in the game (The highest level with numerous character) int Y
client_ip Client IP. This value extracts the value of country from GeoIP string(32) Y
server_ip Server IP string(32) N
device_name User device model
e.g., iPhone, iPad, SM-G935, LGM-G600S
string(32) Y
company Game publishing company, the target of log:
e.g., "C2S": Com2uS, "GVI": Com2uS Holdings
string(3) Y
server_id Server Code
See Server Code Table to input 'JSON Input Code'
string Y
server_uid User identifier used in game server bigint Y
last_login_date The last login time yesterday
If the user signs up today, set this field as the login time
Format: yyyy-mm-dd hh🇲🇲ss
e.g., 2017-02-28 14:33
string Not required, but recommended.
country Input the country code directly if client_ip is not given.
Reference: Identifier Policy
e.g., KR
string(2) N
os_version OS version information.
e.g., 9.2.1
string(10) Not required, but recommended.
game_language Language set in the game. two small letters.
Reference: Identifier Policy
e.g., ko
varchar Not required, but recommended.
is_emulator If connecting with Emulator for PC such as BlueStacks, return 1; unless, return 0
to the PC version, return 2
int Not required, but recommended.
guid Unique key generated per log
Random format such as uuid is recommended
varchar(64) N

Log sample

{
    "date": "2012-11-26 13:32:45",
    "dateTime": "2012-11-26 13:32:45",
    "category": "derbyday_login_log",
    "channel": "KAK",
    "user_id": "**174577796603776",
    "app_id": "com.com2us.derbyday.kakao.freefull.google.global.android.common",
    "client_ip": "203.236.26.252",
    "server_ip": "112.175.60.138",
    "level": 28,
    "guid": "ca4bd34c867f4617a819ae139d8d6670"
}

Collected database schema (reduced)

CREATE TABLE `LOGIN_LOG_20131031` (
    `log_id` BIGINT(20) NOT NULL AUTO_INCREMENT,
    `login_date` DATE NOT NULL,
    `last_login_date` DATETIME NULL,
    `app_id` VARCHAR(200) NOT NULL,
    `channel` VARCHAR(3) NOT NULL,
    `user_id` BIGINT(20) NOT NULL,
    `device_name` VARCHAR(128) NOT NULL DEFAULT 'unknown',
    `level` INT(11) NOT NULL,
    `country` CHAR(2) NULL DEFAULT NULL,
    `count` INT(11) NOT NULL,
    `add_date` DATETIME NOT NULL,
    `mod_date` DATETIME NOT NULL,
    `db_date` DATETIME NOT NULL,
    PRIMARY KEY (`log_id`),
    UNIQUE INDEX `ix_unique` (`login_date`, `app_id`, `channel`, `user_id`, `device_name`)
)
COLLATE='utf8_general_ci'
ENGINE=InnoDB

Scribe type

<?php
$GLOBALS['THRIFT_ROOT'] = '/dev/scribe-php'; // This route is changable. Modify it in accordance with the development environment.
include_once $GLOBALS['THRIFT_ROOT'].'/scribe.php';
include_once $GLOBALS['THRIFT_ROOT'].'/transport/TSocket.php';
include_once $GLOBALS['THRIFT_ROOT'].'/transport/TFramedTransport.php';
include_once $GLOBALS['THRIFT_ROOT'].'/protocol/TBinaryProtocol.php';

public function writeLoginLog($app_id, $channel, $user_id) // Function is an example as well. Modify it in accordance with the development environment. (Category, however, should be fixed as ‘login_log’)
{
        $msg['category'] = 'login_log';
        $msg['message'] = array();
        $msg['message']['date'] = date('Y-m-d H:i:s', time());
        $msg['message']['last_login_date'] = date('Y-m-d H:i:s', time());
        $msg['message']['app_id'] = $app_id;
        $msg['message']['channel'] = $channel;
        $msg['message']['user_id'] = $user_id;
        $msg['message']['level'] = $level;
        $msg['message']['client_ip'] = $client_ip;
        $msg['message']['server_ip'] = $server_ip;

        $msg['message'] = json_encode($msg['message']);

        $entry = new LogEntry($msg);
        $messages = array($entry);
        //var_dump($messages);

        $socket = new TSocket('localhost', 1463, TRUE); // the target host to send logs(fixed port)
        $transport = new TFramedTransport($socket);
        $protocol = new TBinaryProtocol($transport, FALSE, FALSE);
        $scribe_client = new scribeClient($protocol, $protocol);

        $transport->open();
        $scribe_client->Log($messages);
        $transport->close();  
}
?>

How to use

  • Bringing the stacked logs on the server every hour, it provides the state of real-time players by implementing openQuery.
  • It helps you check the amount of users right away through new realases or marketing on games. ](http://developers.withhive.com/wp-content/uploads/2018/05/180514-analytics-login-01-EN.png){width="650px"}
  • Log does not display server_id (identifying server), so it utilizes the table, Login_log.
  • server_id is different depending on games, but it usually divided as follows: 1 (Korea); 2 (Japan); 3 (China); 4 (Global).