As a system operation and maintenance engineer, normal view analysis Linux system log I think we must do the homework every day, but a long time will find that every time we look at the site logs have to go into the background, several servers can also deal with, but if the management of hundreds of online servers, this approach is stretched.
Then I thought about whether I can have a log server centralized
Problem Description:Server B receives message gateway logs from Server A from the remote side, and according to the configuration requirements, these logs need to be written in different files according to the message label classification.For example, there is a log:Sep 08:00:03 192.100.6.3 monster-cmpp20mo[37518]: 20180912080002sms0000999l00100000000cc515275,0,00,,, 09120800018510260295,,,, xxxxxxxxxxx,,, 1,xxxxxxxxxx,,,,,,,,,,,, 0,6,dm302j,We want to be able to write to the Monster-cmppmo.log
Before I was in BASHRC added a sentence, let the system operation log to Rsyslog send a copy of the content, now as long as the sending, and then get the current remote login IP add in it, like this/etc/bashrc1 sshclientip= ' W | Tail-n +3'BEGIN {ip= "local"}{if ($5== "0.00s" | | $! = "-") ip=$3 fi} END {print IP}' c6> '2 prompt_command='history-a > (tee-a ~/.bash_history | logger-p local1.debug-t "$SSH cli
Linux Log default time format: Dec 16 09:52:01, looks not accustomed to, modified to 2014-12-16 09:52:01 feel much more comfortable.Steps:Vi/etc/rsyslog.conf# define your own localized time format$template MyFormat, "% $NOW%%timestamp:8:15%%hostname%%syslogtag%%msg%\n"# Use default timestamp format# $ActionFileDefaultT
Python log format output and time format, python log time format
formatter = logging.Formatter("%(asctime)s %(levelname)s %(message)s","%Y%b%d-%H:%M:%S")
The above % Y and so on are time formats, so to understand the above, Let's first look at the Python time
1. Define the log formatA long time ago, there was only one log file format, which was a "public format" and many people were used to this format. The custom log format appear
First, let's take a look at nginx log configurationLogs are advantageous for troubleshooting statistics. This article summarizes nginx log-Related configurations such as access_log, log_format, open_log_file_cache, log_not_found, log_subrequest, rewrite_log, and error_log.Nginx has a flexible logging mode. Each configuration level can have independent access logs. The
Nginx Log File Format and cut Log File
As a Web server, logs are indispensable and need to be viewed frequently. This article introduces how to customize the log format in Nginx and use crontab to schedule tasks to cut log files o
Nginx log format and custom log Configuration
Nginx logs include access logs and error logs.
The access log records the users, pages, user browsers, ip addresses, and other access information.
The error log is used to record server error logs.
The error
detailed format characters are as follows:
% (name) s
Logger's name.
% (levelno) s
log level in digital form
% (levelname) s
The log level in text form
% (pathname) s
The full pathname of the module that called the log outpu
indicates the current time in the string format; % (levelname) s, for logger. debug, it is DEBUG, if it is logger. error, it is ERROR; % (message) s, if there is a logger. warning ("HAHA") is the string HAHA at the % (message) s position. The more detailed format is as follows:
% (Name) s
Logger name
% (Levelno) s
Log level in digital fo
Python log format output and time format
formatter = logging.Formatter("%(asctime)s %(levelname)s %(message)s","%Y%b%d-%H:%M:%S")
The above % Y and so on are time formats, so to understand the above, Let's first look at the Python time format.
% A-abbreviated weekday name
% A-full weekday name
% B-abbreviated mo
Mysql slow query log enabling and storage format, mysql Log enabling Storage
Mysql version is mysql5.6.22. The installation environment is Windows 7.
1. Use this query log to find the SQL statement with high efficiency, record it, and monitor it.
You can use the following statement to query and set slow query logs.
each modification will have a record, so that the Binlog log volume will be very large, In particular, when executing a statement such as ALTER TABLE, each record in the table is recorded in the log because of changes in its structure.Statment levelstatment level "Every SQL statement that will be modified" is recorded in the binnary of master. When the slave is copied, the SQL thread parses the Sing Woo or
Operation Steps:One: Define the format of the log in the Apache master configuration fileVim/usr/local/apache2/conf/httpd.confLogformat "%h%l%u%t \"%r\ "%>s%b \"%{referer}i\ "\"%{user-agent}i\ "" combinedLogformat "%h%l%u%t \"%r\ "%>s%b" commonLogformat "%h%l%u%t \"%r\ "%>s%b" AlexNote: First define the output format and alias (combined, Common, Alex) of the
Tags: InnoDB redo Logmodifying n bytes on a page can be considered a physical log. These include the following types: Mlog_write_string, Mlog_8bytes, Mlog_2bytes, Mlog_1bytes, Mlog_4bytes. Various page-linked table pointer modifications and file header, Segment page content modifications are recorded in these ways log. The specific format is as follows:1, Mlog_2b
[MySQLbinlog] thoroughly parses the binary log in the Mixed log format
[MySQL binlog] thoroughly parses the binlog in the Mixed log format
Mysql binlog3 formats, row, mixed, statement. Parsing
Mysqlbinlog -- base64-output = DECODE-ROWS-v mysql-bin.000144 | more
-- Base
> Show Binlog events in ' master_bin.000003 '; Easy view of what is being done during each POSBased on the statement statement# at 781#141116 22:40:42 Server ID end_log_pos 897 CRC32 0x63842d06 Query thread_id=3 exec_time=0 error_code=0SET timestamp=1416148842/*!*/;Insert Student (Id,name) VALUES (1, ' Andy ')/*!*/;| master_bin.000003 | 781 | Query | 100 | 897 | Use ' mydb '; Insert Student (Id,name) VALUES (1, ' Andy ')Row-based# at 1254#141116 22:43:38 server ID end_log_pos 1303 CRC32 0x
know it happened, but what was wrong? What is the context information?
The third negative example is the "Magic Log". A real example: a lot of programmers on the team know that 3 numbers follow! Number followed by a #, followed by a pseudo-random number of logs means "the message with ID XYZ is received." No one wants to change the log, someone knocks on the keyboard, selects a unique "!#" string, and he
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.