Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What is PostgreSQL 12's improvement in logging?

2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)05/31 Report--

This article focuses on "what is the improvement of PostgreSQL 12 in logging". Interested friends may wish to have a look at it. The method introduced in this paper is simple, fast and practical. Let's let the editor take you to learn "what is the improvement of PostgreSQL 12 in logging?"

For each client connection, PG requests Postmaster, and then fork a background process to process the request. Postmaster expects each client request to send startup message to the information in PG Server,startup packet to configure the background process of fork. Requests for port scanning, heartbeat detection in the HA solution, and so on, are sent to PG Server port,PG to start a process to process these connections, but security checks, HA scripts, and so on are different from regular clients. For these requests, PG generates a log entry, which causes the log file to swell and result in unnecessary IO overhead.

PG 11

Using the tool nc to access the database port, useless log entries are generated in the log.

[xdb@localhost] $psql-c 'select version ();' Timing is on.Expanded display is used automatically. Version- -PostgreSQL 11.2 on x86_64-pc-linux-gnu Compiled by gcc (GCC) 4.8.5 20150623 (Red Hat 4.8.5-16), 64-bit (1 row) Time: 56.253 ms [xdb@localhost] $[xdb@localhost] $for i in {1.. 100} Do nc-zv localhost 5110 DoneNcat: 0 bytes sent, 0 bytes received in 0.01 seconds.Ncat: Version 7.50 (https://nmap.org/ncat) Ncat: Connected to:: 1:5110.Ncat: 0 bytes sent, 0 bytes received in 0.01 seconds.Ncat: Version 7.50 (https://nmap.org/ncat) Ncat: Connected to:: 1:5110.Ncat: 0 bytes sent, 0 bytes received in 0.01 seconds.Ncat: Version 7.50 (https://nmap.org/ncat) Ncat: Connected to:: 1:5110.Ncat: 0 bytes sent 0 bytes received in 0.01 seconds.Ncat: Version 7.50 (https://nmap.org/ncat) Ncat: Connected to:: 1:5110.Ncat: 0 bytes sent, 0 bytes received in 0.01 seconds....

Database log output

2019-12-09 14 CST,16065 35CST,16067 55.468 CST,16065, ": 1dedeb47554", 5dedeb4b.3ec1jue 1, ", 2019-12-09 14:35:55 CST,0,LOG,08P01," incomplete startup packet "," 2019-12-09 14MAV 35MAV 55.479 CST,16067, ": 1dede57556", 5dedeb4b.3ec3 CST,0,LOG,08P01 1, ", 2019-12-09 14:35:55 CST,0,LOG,08P01," incomplete startup packet " 2019-12-09 14:35:55 CST,0,LOG,08P01, "incomplete startup packet", "2019-12-09 14CST,0,LOG,08P01 3535 CST,16071,":: 1dede4b.3ec7 CST,0,LOG,08P01 1, "2019-12-09 14:35:55 CST,0,LOG,08P01,"incomplete startup packet" 2019-12-09 14:35:55 CST,0,LOG,08P01, "incomplete startup packet", "2019-12-09 14:35:55 CST,0,LOG,08P01".

These logs are actually useless log information and can be left unrecorded.

PG 12

[xdb@localhost] $psql-h localhost-p 5120-U pg12-c 'select version ();' Timing is on.Expanded display is used automatically. Version- -PostgreSQL 12.1 on x86_64-pc-linux-gnu Compiled by gcc (GCC) 4.8.5 20150623 (Red Hat 4.8.5-16), 64-bit (1 row) Time: 60.207 ms [xdb@localhost] $[xdb@localhost] $for i in {1.. 100} Do nc-zv localhost 5120 DoneNcat: 0 bytes sent, 0 bytes received in 0.01 seconds.Ncat: Version 7.50 (https://nmap.org/ncat) Ncat: Connected to:: 1:5120.Ncat: 0 bytes sent, 0 bytes received in 0.01 seconds.Ncat: Version 7.50 (https://nmap.org/ncat) Ncat: Connected to:: 1:5120.Ncat: 0 bytes sent, 0 bytes received in 0.01 seconds.Ncat: Version 7.50 (https://nmap.org/ncat) Ncat: Connected to:: 1:5120.Ncat: 0 bytes sent 0 bytes received in 0.01 seconds.Ncat: Version 7.50 (https://nmap.org/ncat) Ncat: Connected to:: 1:5120.Ncat: 0 bytes sent, 0 bytes received in 0.01 seconds.Ncat: Version 7.50 (https://nmap.org/ncat) Ncat: Connected to:: 1:5120.Ncat: 0 bytes sent, 0 bytes received in 0.01 seconds. [xdb@localhost] $.

Database log information, compared to PG 11, there is no useless log information

[pg12@localhost] $tail-f $PGDATA/pg_log/postgresql-2019-12-09.log 2019-12-09 14 PGDATA/pg_log/postgresql-2019 18V 59.317 CST [1813] LOG: ending log output to stderr2019-12-09 14 14 PGDATA/pg_log/postgresql-2019 59.317 CST [1813] HINT: Future log output will go to log destination "csvlog". At this point, I believe you have a deeper understanding of "what is the improvement of PostgreSQL 12 in logging". You might as well do it in practice. Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report