1、安装查看Logtail
wget http://logtail-release-cn-hangzhou.oss-cn-hangzhou.aliyuncs.com/linux64/logtail.sh -O logtail.sh; chmod 755 logtail.sh; ./logtail.sh install cn-hangzhou-internet
2、查看Logtail版本
Logtail会将版本信息记录在/usr/local/ilogtail/app_info.json中的logtail_version字段,例如:
$cat /usr/local/ilogtail/app_info.json
{
"UUID" : "0DF18E97-0F2D-486F-B77F-*********",
"hostname" : "david*******",
"instance_id" : "F4FAFADA-F1D7-11E7-846C-00163E30349E_*********_1515129548",
"ip" : "**********",
"logtail_version" : "0.16.0",
"os" : "Linux; 2.6.32-220.23.2.ali1113.el5.x86_64; #1 SMP Thu Jul 4 20:09:15 CST 2013; x86_64",
"update_time" : "2018-01-05 13:19:08"
}
3、升级Logtail
您可以通过 Logtail 安装器(logtail.sh)来进行 Logtail 的升级,安装器会根据已经安装的Logtail配置信息自动选择合适的方式进行升级。
说明 升级过程中会短暂停止 Logtail,但升级只会覆盖必要的文件,配置文件以及Checkpoint文件将会被保留。升级期间日志不会丢失。
执行以下命令升级Logtail:
# 下载安装器
wget http://logtail-release-cn-hangzhou.oss-cn-hangzhou.aliyuncs.com/linux64/logtail.sh -O logtail.sh; chmod 755 logtail.sh
# 执行升级命令
sudo ./logtail.sh upgrade
执行结果:
# 升级成功
Stop logtail successfully.
ilogtail is running
Upgrade logtail success
{
"UUID" : "***",
"hostname" : "***",
"instance_id" : "***",
"ip" : "***",
"logtail_version" : "0.16.11",
"os" : "Linux; 3.10.0-693.2.2.el7.x86_64; #1 SMP Tue Sep 12 22:26:13 UTC 2017; x86_64",
"update_time" : "2018-08-29 15:01:36"
}
# 升级失败:已经是最新版本
[Error]: Already up to date.
4、手动启动和停止Logtail
启动
以管理员身份执行:
/etc/init.d/ilogtaild start
停止
以管理员身份执行:
/etc/init.d/ilogtaild stop
5、卸载Logtail
执行以下命令,下载安装器logtail.sh并卸载Logtail。
wget http://logtail-release-cn-hangzhou.oss-cn-hangzhou.aliyuncs.com/linux64/logtail.sh -O logtail.sh
chmod 755 logtail.sh; ./logtail.sh uninstall
6、创建用户自定义标识机器组
# echo changshan > /etc/ilogtail/user_defined_id
# cat /etc/ilogtail/user_defined_id
changshan
7、配置主账号AliUid作为用户标识
touch /etc/ilogtail/users/xxxxxxxxxxxxxxxxxxx