百度智能云

All Product Document

          Log Service

          Install a Collector

          Collector is a service component provided by Baidu Log Service and installed on the CVM server. After installation, the collector monitors the relevant files, collects the contents of log files, and delivers them to the destination address. Currently, collector currently supports 64-bit Linux systems. If required to support other systems, apply for a Ticket.

          Installation Steps

          1.Log in to the Baidu Smart Cloud Console, select "Product Services > Data Analysis > Baidu Log Service BLS" in the navigation bar to enter the Baidu Log Service page.

          2.To use the Baidu Log Service (BLS) for the first time, you need to activate it by clicking the "Activate the Service” button.

          3.Click "Collector" on the left navigation bar and select "Collector Installation" from the submenu to enter the collector installation page.

          4.The system has automatically created an authentication Token and generated an installation command bound to this Token and the operating system. You can use this installation command to install the collector of the Baidu Log Service in your CVM Server. BLS supports installation and deployment in CentOS, Ubuntu, and Debian systems. Select your own operating system and click the "Copy" button to copy the installation command into your clipboard.

          image.png

          Note: If the "Copy" button of the installation command is not displayed, see the FAQ: Why is the "Copy" button of the installation command not displayed in the browser?

          5.Installation command example and explanations.

             wget -O - https://logbeat-repo-sz.su.bcebos.com/install-logbeat-sz.sh | bash /dev/stdin <token value> <OS version> install /opt root

          In this command, represents the unique authentication identifier of the user on the BLS server side, which does not need to be modified by the user; is the installed system version, such as centos/ubuntu/debian; then the installation command is executed; finally, for the collector installation directory and local running user, you can customize the installation directory and local running user. Note that the last parameter specifies the user who runs the collector locally, and the user who executes the installation command is not necessarily the same user. The difference is that, one is which user is used to install the collector, such as root, etc.; the other is which user is used to start the collector, such as work.

          Note: Multiple collectors can be installed on the same machine, as long as different installation directories are specified, different collectors run independently of each other, but only one collector should be installed for the same token.

          6.Log in to your host, and you can execute the installation command under root authority. Then, if the local running account does not exist, the installation script will create the local running account and start the collector with it. And execute the installation command under root privileges, and the script will add service commands to the system: service logbeatd [start/stop/status/restart] and auto start-up service.

          Note: After starting the collector with the local account you specify, for the file to be collected, you should have the read permission of the account, and the directory path needs the read and execute permission of the account.

          7.You can also use a non-root user to install the collector. It should be noted that the difference with the root user installation is that the installation script does not add service commands and auto start-up services.

          8.If the following information is displayed, the collector is successfully installed.

              Configure agent with token: 2687cdf2-245d-6c3f-37ba-d7ad84925024 ...done.
              Start bls agent.

          How to Deploy Tasks while Installing Collector

          If you want to package the collector provided by the log service into an image file to quickly deploy the server with the same configuration, first create transmission task, and then add task parameters during installation as described below:

          1. Select the corresponding operating system on the “Collector Installation” page and copy the installation command.
          2. Find and select the transmission tasks you want to preset in the transmission list, and record the task ID of the transmission tasks.
          3. Attach these task IDs as task parameters to the end of the installation command in the following format:

            		wget -O - https://logbeat-repo-sz.su.bcebos.com/install-logbeat-sz.sh | bash /dev/stdin <token value> <OS version> install /opt root[task1ID,task2ID,task3ID...]

            Notes:
            a) You must leave a space between the task ID list and the previous parameter.
            b) Multiple tasks must be connected with an English sign "," and no space is allowed.
            c) The task list must be wrapped in English "[]".
            d) Only the ID of transmission task created under your account is supported. You cannot add transmission tasks created by others.
            e) The ID of transmission task does not affect the normal operation of the collectors.

            The example is as follows: Install a collector and deploy two transmission tasks in Ubuntu CVM Server.

             `wget -O - https://logbeat-repo-sz.su.bcebos.com/install-logbeat-sz.sh | bash /dev/stdin cdda****5880 ubuntu install /opt  root [3482****4b6a,b5b6****2c93]`

          Update Collector

          The update method is to execute the bin/update.sh script in the root directory of the collector. The script can be accompanied by a parameter [version], such as:

          sh bin/update.sh  [latest/1.1.1]

          If you leave it blank, it is latest by default, indicating it is the up-to-date collector.

          Uninstall Collector

          Step 1: Stop the collector process: service logbeatd stop; Or execution /opt/logbeat/bin/stop.sh;

          Step 2: Delete the collector directory: rm -rf /opt/ logbeat.

          Previous
          Prepare the Baidu AI Cloud Environment
          Next
          Manage Collectors