如何编译安装cronolog?

编译安装

1 基础知识

一般情况下程序输出日志月累会有日志文件过大问题,所以衍生出日志切割工具,“cronolog”是其中一种简单的日志切割工具(笔者更加推荐使用logrotate)。
另外,由于该项目更新缓慢,所以本章只简单记录编译安装的方法,并不做过多的研究。

2 最佳实践

2.1 环境信息

OS = CentOS 8.0 x86_64
IP Addresses = any.cmdschool.org
Host Name = any

2.2 安装编译工具

yum -y install gcc gcc-c++ make expat-devel autoconf

2.3 下载软件包

cd ~
wget https://codeload.github.com/fordmason/cronolog/zip/master

2.4 解压软件包

cd ~
unzip cronolog-master.zip

2.5 预编译软件包

cd ~/cronolog-master/
./configure

如有如下错误提示,

configure: error: cannot find sources (bootstrap) in . or ..

可使用如下命令方法解决,

cd ~/cronolog-master/
ln -s configure.ac bootstrap

2.6 编译软件包

make

2.7 安装软件包

make install

2.8 测试安装的软件包

cronolog -h

可见如下提示,

usage: cronolog [OPTIONS] logfile-spec

   -H NAME,   --hardlink=NAME maintain a hard link from NAME to current log
   -S NAME,   --symlink=NAME  maintain a symbolic link from NAME to current log
   -P NAME,   --prev-symlink=NAME  maintain a symbolic link from NAME to previous log
   -l NAME,   --link=NAME     same as -S/--symlink
   -h,        --help          print this help, then exit
   -p PERIOD, --period=PERIOD set the rotation period explicitly
   -d DELAY,  --delay=DELAY   set the rotation period delay
   -o,        --once-only     create single output log from template (not rotated)
   -x FILE,   --debug=FILE    write debug messages to FILE
                              ( or to standard error if FILE is "-")
   -a,        --american         American date formats
   -e,        --european      European date formats (default)
   -s TIME,   --start-time=TIME   starting time
   -z TZ,     --time-zone=TZ  use TZ for timezone
   -V,        --version       print version number, then exit

参阅文档
=========================

github官方地址
—————
https://github.com/WayneD/cronolog

故障处理
————–
https://github.com/fordmason/cronolog/issues/3

没有评论

发表回复

Tomcat
如何编译安装Tomcat的Native库?

1 基础知识 Tomcat的Native库允许Tomcat使用OpenSSL作为JSSE的替代品来支 …

编译安装
如何基于Oracle Linux 9.x 编译BerkeleyDB?

1 基础知识 1.1 简介 Berkeley DB是一个开源的文件数据库,介于关系数据库与内存数据库 …

编译安装
如何在Oracle Linux 9.x编译部署Redis?

1 基础知识 1.1 Redis的简介 Redis是一种开放源代码(BSD许可)的运行于内存中的数据 …