tencent cloud


LogListener Installation Guide

Last updated: 2022-09-19 12:12:21

    LogListener is a log collector provided by CLS. You can install and deploy it on a server to collect logs quickly.

    Installation Environment

    LogListener supports only Linux 64-bit operating systems and does not support Windows now. It is compatible with mainstream Linux operating system versions. If LogListener is incompatible with the Linux operating system version you use, submit a ticket.

    OS                Compatible Versions
    CentOS (64-bit) CentOS_6.8_64-bit, CentOS_6.9_64-bit, CentOS_7.2_64-bit, CentOS_7.3_64-bit, CentOS_7.4_64-bit, CentOS_7.5_64-bit, CentOS_7.6_64-bit, CentOS_8.0_64-bit
    Ubuntu (64-bit) Ubuntu Server_14.04.1_LTS_64-bit, Ubuntu Server_16.04.1_LTS_64-bit, Ubuntu Server_18.04.1_LTS_64-bit
    Debian (64-bit) Debian_8.2_64-bit, Debian_9.0_64-bit
    openSUSE (64-bit) openSUSE_42.3_64-bit

    Supported Features

    Key features supported by different LogListener versions are as listed below. For more information, see LogListener Updates.

    LogListener Version Supported Feature Feature Description Documentation
    v2.7.4 Host name collection (hostname) LogListener collects and reports the machine host name as a default field and displays __HOSTNAME__ as a key, such as __HOSTNAME__:VM-108-centos. -
    v2.6.4 Combined parsing to customize complex log parsing rules You can use LogListener's combined parsing mode to parse logs. This mode allows you to enter JSON code in the console to customize the log parsing pipeline logic. Combined Parsing Format
    v2.6.0 CVM batch deployment You can select CVM instances in the console and batch distribute LogListener deployment tasks through an API to automatically complete LogListener installation and deployment (including accesskey, ID, and region configuration). Deploying LogListener on CVMs in Batches
    v2.5.4 LogListener service logs LogListener service logs are used to record the operation, collection, and monitoring activities of LogListener, and you can configure visual graphs to display such log data. LogListener Service Logs
    v2.5.2 Uploading parsing-failed logs Parsing-failure logs can be uploaded, using LogParseFailure as the key name (Key) and the raw log content as the key value (Value). -
    v2.5.0 LogListener auto-upgrade function Users can set a time period for Agent auto-upgrade or select specific machine groups to upgrade manually. LogListener Upgrade Guide
    v2.4.5 Multi-line log extraction with regex The extraction mode of Multi-line - Full regular expression is added to LogListener collection configuration rules for log collection. Full Regular Expression (Multi-Line)

    Installation and startup

    1. Downloading and installing LogListener

    Download links of the latest version LogListener: Download by public network, Download by private network

    Download the LogListener installation package and decompress it to the installation path (/usr/local/ in this example). Then go to the LogListener directory loglistener/tools and run the following installation command.

    • Operation command for the public network:

      wget https://mirrors.tencent.com/install/cls/loglistener-linux-x64-2.8.2.tar.gz  && tar -zxvf loglistener-linux-x64-2.8.2.tar.gz -C /usr/local && cd /usr/local/loglistener-2.8.2/tools && ./loglistener.sh install
    • Operation command for the private network:

      wget http://mirrors.tencentyun.com/install/cls/loglistener-linux-x64-2.8.2.tar.gz  && tar -zxvf loglistener-linux-x64-2.8.2.tar.gz -C /usr/local && cd /usr/local/loglistener-2.8.2/tools && ./loglistener.sh install

    2. Initializing LogListener

    In the loglistener/tools path, run the following command to initialize LogListener as the root user. By default, a private network is used to access the service:

    ./loglistener.sh init -secretid AKIDPEtPyKabfW8Z3Uspdz83xxxxxxxxxxx -secretkey whHwQfjdLnzzCE1jIf09xxxxxxxxxxxx -region ap-xxxxxx

    You need to replace -secretid, -secretkey, -region, and -network in the command with the actual values. For more information, see Parameter description below.

    Parameter description

    Parameter Description
    secretid Part of the Cloud API key. Used to identify who calls the API.
    secretkey Part of the Cloud API key. Used to encrypt signature strings and verify server-side signature strings.
    region Region where CLS resides. Enter a region abbreviation here, such as ap-beijing or ap-guangzhou.
    network Type of the network through which LogListener accesses the service by domain name. Valid values: intra (private network), internet (public network). Default value: intra
    ip Machine IP. If this parameter is left empty, LogListener will automatically get the local IP address.
    label Machine group label, which is required if you want to identify the machine group. Multiple labels should be separated by comma.

    A private network domain name is used by default:

    If you need to access the service by domain name through the public network, run the following command to set the network parameter internet explicitly:

    ./loglistener.sh init -secretid AKIDPEtPyKabfW8Z3Uspdz83xxxxxxxxxxxx -secretkey whHwQfjdLnzzCE1jIf0xxxxxxxxxxxx -region ap-xxxxxx -network internet


    • We recommend that you use a collaborator key if the collaborator has been assigned with the CLS read/write permission by the root account.
    • region indicates the region of the CLS you use, instead of the region where your business machine resides.
    • If your CVM instance and logset are in the same region, we recommend you access the service domain name over the private network; otherwise, use the public network.
    • For details about log collection, see Examples of Custom Access Policies.

    3. Starting LogListener

    After LogListener is successfully installed, run the following command to start it:

    /etc/init.d/loglistenerd start

    Common LogListener Operations


    The operation commands used in this document are applicable only to LogListener v2.2.4 and later versions. For operation commands applicable to earlier versions, see Operation Guide of Earlier LogListener Versions.

    1. Checking the LogListener version

    /etc/init.d/loglistenerd -v

    2. Viewing LogListener help documentation

    /etc/init.d/loglistenerd -h

    3. Managing LogListener process

    /etc/init.d/loglistenerd (start|restart|stop) # Start, restart, stop

    4. Checking LogListener process status

    /etc/init.d/loglistenerd status

    LogListener normally runs two processes:

    5. Checking LogListener heartbeat and configuration

    /etc/init.d/loglistenerd check

    Uninstalling LogListener

    In the loglistener/tools directory, run the uninstallation command as the admin:

    ./loglistener.sh uninstall

    Manually Updating LogListener

    Reusing the breakpoint file (logs are not repeatedly collected)

    1. Run the stop command to stop the existing LogListener.

    2. Back up the breakpoint file directory (loglistener/data) on the earlier version; for example, back up the legacy breakpoint file to the /tmp/loglistener-backup directory.

      cp -r loglistener-2.2.3/data /tmp/loglistener-backup/
    3. Run the uninstallation command to uninstall the existing LogListener.

    4. Download the latest version of LogListener. Then, install and initialize it with relevant commands.

    5. Copy the breakpoint file directory backed up in step 2 to the new LogListener directory.

      cp -r /tmp/loglistener-backup/data loglistener-<version>/

      Change the value of <version> as required. The following is an example:

      cp -r /tmp/loglistener-backup/data loglistener-2.8.2/
    6. Run the start command to start the latest version of LogListener.

    Not reusing the breakpoint file (logs may be repeatedly collected)

    1. Run the stop command to stop the existing LogListener.
    2. Run the uninstallation command to uninstall the earlier version of LogListener.
    3. Download the latest version of LogListener. Then, install and initialize it with relevant commands.
    4. Run the start command to start the latest version of LogListener.
    Contact Us

    Contact our sales team or business advisors to help your business.

    Technical Support

    Open a ticket if you're looking for further assistance. Our Ticket is 7x24 avaliable.

    7x24 Phone Support