Introduction
Last Updated:2020-09-08
This article takes the collection of logs generated continuously by a server as an example to introduce the basic concepts for Baidu Log Service (BLS) and the implementation process of log collection.
Basic Concepts
- Collector: The collector is a service component provided by the Baidu Log Service and installed on the CVM server. It provides a secure and reliable log collection service to ensure normal operation of applications and that a perfect exception handling mechanism is available.
- Token: Token is a verification string which is used to authenticate the user identity. It is used in the configuration file of the collector, and should be safekept properly.
- Transmission task: The transmission task is the execution and management unit of the log service. With the help of transmission task, you can configure and manage the log source, delivery address, and collection rules.
Operating Process
Log Format
Baidu Log Service currently supports UTF-8-coded logs.
Log information on the example given in this article
- The log files of a server are stored in the /home/work /nginx_logs directory.
- Logs for every day are written into a separate file. The file that is being written is named with ".log", and the finished log file has a timestamp suffix "YYYY-MM-DD".
The log information is as follows:
#ls -al /home/work/nginx_logs
drwxr-xr-x.2 work work 4096 June 16 08:35 .
drwxr-xr-x.3 work work 4096 June 5 08:35 ..
-rw-r--r--.1 work work 3396 June 16 08:35 access.log
-rw-r--r--.1 work work 4843 June 12 12:34 access.log.2016-06-12
-rw-r--r--.1 work work 9686 June 13 2:21 PM access.log.2016-06-13
-rw-r--r--.1 work work 7322 June 14 10:35 AM access.log.2016-06-14
-rw-r--r--.1 work work 7062 June 15 10:55 AM access.log.2016-06-15
The "access.log" file is the file being written on June 16, 2016, and the "access.log.2016-06-15" is the off-line log file finished on June 15.