Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
Postgres FD Implementation
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Abuhujair Javed
Postgres FD Implementation
Commits
f4c454e9
Commit
f4c454e9
authored
Feb 26, 2016
by
Peter Eisentraut
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add syslog_sequence_numbers parameter
Reviewed-by:
Andreas Karlsson
<
andreas@proxel.se
>
parent
47211af1
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
50 additions
and
2 deletions
+50
-2
doc/src/sgml/config.sgml
doc/src/sgml/config.sgml
+28
-0
src/backend/utils/error/elog.c
src/backend/utils/error/elog.c
+10
-2
src/backend/utils/misc/guc.c
src/backend/utils/misc/guc.c
+10
-0
src/backend/utils/misc/postgresql.conf.sample
src/backend/utils/misc/postgresql.conf.sample
+1
-0
src/include/utils/elog.h
src/include/utils/elog.h
+1
-0
No files found.
doc/src/sgml/config.sgml
View file @
f4c454e9
...
@@ -4305,6 +4305,34 @@ local0.* /var/log/postgresql
...
@@ -4305,6 +4305,34 @@ local0.* /var/log/postgresql
</listitem>
</listitem>
</varlistentry>
</varlistentry>
<varlistentry id="guc-syslog-sequence-numbers" xreflabel="syslog_sequence_numbers">
<term><varname>syslog_sequence_numbers</varname> (<type>boolean</type>)
<indexterm>
<primary><varname>syslog_sequence_numbers</> configuration parameter</primary>
</indexterm>
</term>
<listitem>
<para>
When logging to <application>syslog</application> and this is on (the
default), then each message will be prefixed by an increasing
sequence number (such as <literal>[2]</literal>). This circumvents
the <quote>--- last message repeated N times ---</quote> suppression
that many syslog implementations perform by default. In more modern
syslog implementations, repeat message suppression can be configured
(for example, <literal>$RepeatedMsgReduction</literal>
in <productname>rsyslog</productname>), so this might not be
necessary. Also, you could turn this off if you actually want to
suppress repeated messages.
</para>
<para>
This parameter can only be set in the <filename>postgresql.conf</>
file or on the server command line.
</para>
</listitem>
</varlistentry>
<varlistentry id="guc-event-source" xreflabel="event_source">
<varlistentry id="guc-event-source" xreflabel="event_source">
<term><varname>event_source</varname> (<type>string</type>)
<term><varname>event_source</varname> (<type>string</type>)
<indexterm>
<indexterm>
...
...
src/backend/utils/error/elog.c
View file @
f4c454e9
...
@@ -106,6 +106,7 @@ int Log_error_verbosity = PGERROR_VERBOSE;
...
@@ -106,6 +106,7 @@ int Log_error_verbosity = PGERROR_VERBOSE;
char
*
Log_line_prefix
=
NULL
;
/* format for extra log line info */
char
*
Log_line_prefix
=
NULL
;
/* format for extra log line info */
int
Log_destination
=
LOG_DESTINATION_STDERR
;
int
Log_destination
=
LOG_DESTINATION_STDERR
;
char
*
Log_destination_string
=
NULL
;
char
*
Log_destination_string
=
NULL
;
bool
syslog_sequence_numbers
=
true
;
#ifdef HAVE_SYSLOG
#ifdef HAVE_SYSLOG
...
@@ -2018,7 +2019,11 @@ write_syslog(int level, const char *line)
...
@@ -2018,7 +2019,11 @@ write_syslog(int level, const char *line)
chunk_nr
++
;
chunk_nr
++
;
syslog
(
level
,
"[%lu-%d] %s"
,
seq
,
chunk_nr
,
buf
);
if
(
syslog_sequence_numbers
)
syslog
(
level
,
"[%lu-%d] %s"
,
seq
,
chunk_nr
,
buf
);
else
syslog
(
level
,
"[%d] %s"
,
chunk_nr
,
buf
);
line
+=
buflen
;
line
+=
buflen
;
len
-=
buflen
;
len
-=
buflen
;
}
}
...
@@ -2026,7 +2031,10 @@ write_syslog(int level, const char *line)
...
@@ -2026,7 +2031,10 @@ write_syslog(int level, const char *line)
else
else
{
{
/* message short enough */
/* message short enough */
syslog
(
level
,
"[%lu] %s"
,
seq
,
line
);
if
(
syslog_sequence_numbers
)
syslog
(
level
,
"[%lu] %s"
,
seq
,
line
);
else
syslog
(
level
,
"%s"
,
line
);
}
}
}
}
#endif
/* HAVE_SYSLOG */
#endif
/* HAVE_SYSLOG */
...
...
src/backend/utils/misc/guc.c
View file @
f4c454e9
...
@@ -1632,6 +1632,16 @@ static struct config_bool ConfigureNamesBool[] =
...
@@ -1632,6 +1632,16 @@ static struct config_bool ConfigureNamesBool[] =
NULL
,
NULL
,
NULL
NULL
,
NULL
,
NULL
},
},
{
{
"syslog_sequence_numbers"
,
PGC_SIGHUP
,
LOGGING_WHERE
,
gettext_noop
(
"Add sequence number to syslog messags to avoid duplicate suppression."
),
NULL
},
&
syslog_sequence_numbers
,
true
,
NULL
,
NULL
,
NULL
},
/* End-of-list marker */
/* End-of-list marker */
{
{
{
NULL
,
0
,
0
,
NULL
,
NULL
},
NULL
,
false
,
NULL
,
NULL
,
NULL
{
NULL
,
0
,
0
,
NULL
,
NULL
},
NULL
,
false
,
NULL
,
NULL
,
NULL
...
...
src/backend/utils/misc/postgresql.conf.sample
View file @
f4c454e9
...
@@ -358,6 +358,7 @@
...
@@ -358,6 +358,7 @@
# These are relevant when logging to syslog:
# These are relevant when logging to syslog:
#syslog_facility = 'LOCAL0'
#syslog_facility = 'LOCAL0'
#syslog_ident = 'postgres'
#syslog_ident = 'postgres'
#syslog_sequence_numbers = on
# This is only relevant when logging to eventlog (win32):
# This is only relevant when logging to eventlog (win32):
#event_source = 'PostgreSQL'
#event_source = 'PostgreSQL'
...
...
src/include/utils/elog.h
View file @
f4c454e9
...
@@ -397,6 +397,7 @@ extern int Log_error_verbosity;
...
@@ -397,6 +397,7 @@ extern int Log_error_verbosity;
extern
char
*
Log_line_prefix
;
extern
char
*
Log_line_prefix
;
extern
int
Log_destination
;
extern
int
Log_destination
;
extern
char
*
Log_destination_string
;
extern
char
*
Log_destination_string
;
extern
bool
syslog_sequence_numbers
;
/* Log destination bitmap */
/* Log destination bitmap */
#define LOG_DESTINATION_STDERR 1
#define LOG_DESTINATION_STDERR 1
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment