<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>article How to enable and collect the PostGres SQL database logs in Official Support Articles</title>
    <link>https://community.qlik.com/t5/Official-Support-Articles/How-to-enable-and-collect-the-PostGres-SQL-database-logs/ta-p/1712186</link>
    <description>&lt;P&gt;There may be situations where the &amp;nbsp;QlikSense repository PostgreSQL database stops responding due to a large number of connections. It may start facing timeout or performance issues.&lt;/P&gt;
&lt;P&gt;At this stage, it may become necessary to look into the database logs in addition to the QlikSense logs. Same would apply to the &amp;nbsp;NPrinting PostgreSQL database.&lt;/P&gt;
&lt;OL&gt;
&lt;LI&gt;Open the Windows Services Console&lt;/LI&gt;
&lt;LI&gt;Stop the Qlik Sense Repository Database Service&lt;BR /&gt;&lt;BR /&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="PostgreSQL_Logging01_StopServices.png" style="width: 999px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/43702iB74238C5771E96CC/image-size/large?v=v2&amp;amp;px=999" role="button" title="PostgreSQL_Logging01_StopServices.png" alt="PostgreSQL_Logging01_StopServices.png" /&gt;&lt;/span&gt;
&lt;P&gt; &lt;/P&gt;
&lt;/LI&gt;
&lt;LI&gt;In a File Explorer, navigate to&amp;nbsp;&lt;FONT face="courier new,courier"&gt;C:\ProgramData\Qlik\Sense\Repository\PostgreSQL\9.6\&lt;/FONT&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;SPAN style="font-family: inherit;"&gt;&lt;SPAN style="font-family: inherit;"&gt;Open&amp;nbsp;&lt;FONT face="courier new,courier"&gt;postgresql.conf&lt;/FONT&gt;&amp;nbsp;in a text editor of your choice.&lt;BR /&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="PostgreSQL_Logging02_Postgresqlconfigfile.png" style="width: 999px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/43703i77C01004D5BE47A2/image-size/large?v=v2&amp;amp;px=999" role="button" title="PostgreSQL_Logging02_Postgresqlconfigfile.png" alt="PostgreSQL_Logging02_Postgresqlconfigfile.png" /&gt;&lt;/span&gt;
&lt;P&gt; &lt;/P&gt;
&lt;/LI&gt;
&lt;LI&gt;&lt;SPAN style="font-family: inherit;"&gt;&lt;SPAN style="font-family: inherit;"&gt;In this configuration file, locate the section&amp;nbsp;ERROR REPORTING AND LOGGING and modify it as follows:&lt;BR /&gt;&lt;BR /&gt;Remove the # in front of the logging configuration settings to enable them.&amp;nbsp;&lt;BR /&gt;Switch &lt;FONT face="courier new,courier"&gt;logging_collector = off&lt;/FONT&gt; to &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;FONT face="courier new,courier"&gt;logging_collector = on&lt;/FONT&gt;&lt;SPAN style="font-family: inherit;"&gt;&lt;SPAN style="font-family: inherit;"&gt;&lt;BR /&gt;&lt;BR /&gt;An example of the changed file can be seen below. Note we do not change any default values in our example.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;As we are not making any changes, the logs will be located in:&lt;BR /&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;C:\ProgramData\Qlik\Sense\Repository\PostgreSQL\9.6\pg_log&lt;/FONT&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;LI-CODE lang="markup"&gt;#---------------------------------------------
# ERROR REPORTING AND LOGGING
#---------------------------------------------

# - Where to Log -

log_destination = 'stderr'   # Valid values are combinations of
                             # stderr, csvlog, syslog, and eventlog,
                             # depending on platform.  csvlog
                             # requires logging_collector to be on.


# This is used when logging to stderr:
logging_collector = on       # Enable capturing of stderr and csvlog
                             # into log files. Required to be on for
                             # csvlogs.
                             # (change requires restart)


# These are only used if logging_collector is on:
log_directory = 'pg_log'     # directory where log files are written,
                             # can be absolute or relative to PGDATA


log_filename = 'postgresql-%Y-%m-%d_%H%M%S.log' # log file name pattern,
                                        # can include strftime() escapes

log_file_mode = 0600            # creation mode for log files,
                                # begin with 0 to use octal notation

log_truncate_on_rotation = off  # If on, an existing log file with the
                    # same name as the new log file will be
                    # truncated rather than appended to.
                    # But such truncation only occurs on
                    # time-driven rotation, not on restarts
                    # or size-driven rotation.  Default is
                    # off, meaning append to existing files
                    # in all cases.

log_rotation_age = 1d  # Automatic rotation of logfiles will
                    # happen after that time.  0 disables.

log_rotation_size = 10MB  # Automatic rotation of logfiles will
                    # happen after that much log output.
                    # 0 disables.&lt;/LI-CODE&gt;&lt;SPAN style="font-family: inherit;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/LI&gt;
&lt;LI&gt;Start the Qlik Sense Repository Database Service&lt;BR /&gt;&lt;BR /&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="PostgreSQL_Logging03_StartServices.png" style="width: 999px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/43706i1CD345CEA86F7E76/image-size/large?v=v2&amp;amp;px=999" role="button" title="PostgreSQL_Logging03_StartServices.png" alt="PostgreSQL_Logging03_StartServices.png" /&gt;&lt;/span&gt;
&lt;P&gt; &lt;/P&gt;
&lt;/LI&gt;
&lt;LI&gt;Once the service has started, verify that logging has been correctly turned on by navigating to&amp;nbsp;&lt;FONT face="courier new,courier"&gt;C:\ProgramData\Qlik\Sense\Repository\PostgreSQL\9.6\pg_log&lt;/FONT&gt;.&lt;BR /&gt;&lt;BR /&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="PostgreSQL_Logging04_LogFile.png" style="width: 999px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/43707iAF7E91E6F142EC43/image-size/large?v=v2&amp;amp;px=999" role="button" title="PostgreSQL_Logging04_LogFile.png" alt="PostgreSQL_Logging04_LogFile.png" /&gt;&lt;/span&gt;&lt;/LI&gt;
&lt;/OL&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;H4&gt;&lt;STRONG&gt;Notes: &lt;/STRONG&gt;&lt;/H4&gt;
&lt;P&gt;Will there be a performance impact by enabling PostgreSQL logging?&lt;BR /&gt;&lt;BR /&gt;R&amp;amp;D did some testing with the following settings:&lt;/P&gt;
&lt;DIV style="margin-left: 40px;"&gt;&lt;LI-CODE lang="markup"&gt;in the postgresql.conf file:
log_destination = 'csvlog'
logging_collector = on
log_connections = on
log_disconnections = on
log_hostname = on
log_statement = 'all'
log_line_prefix = '%a%%%u%%%s'&lt;/LI-CODE&gt;&lt;/DIV&gt;
&lt;P&gt;&amp;nbsp;&lt;BR /&gt;R&amp;amp;D's statement from their testing:&lt;/P&gt;
&lt;DIV style="margin-left: 40px;"&gt;&lt;STRONG&gt;Average response time:&lt;/STRONG&gt;&lt;BR /&gt;Slightly higher with logging enabled but the biggest difference was only 4ms. Average time without logging 163ms, with logging 166ms.&lt;BR /&gt;&lt;BR /&gt;&lt;STRONG&gt;Processor time:&lt;/STRONG&gt;&lt;BR /&gt;PostgreSQL used very little CPU time. Average time without logging was 0.29%, with logging 0.33%.&lt;BR /&gt;&lt;BR /&gt;&lt;STRONG&gt;Memory usage:&lt;/STRONG&gt;&lt;BR /&gt;Here, slightly less memory was used with logging enabled. Average without logging 1.16GB, with logging 1.13GB.&lt;BR /&gt;&lt;BR /&gt;&lt;STRONG&gt;Log files on disk:&lt;/STRONG&gt;&lt;BR /&gt;With logging enabled, a number of files were created on the local disk. About 10MB of data were created every minute.&lt;BR /&gt;&lt;BR /&gt;&lt;STRONG&gt;The conclusion from the tests:&lt;/STRONG&gt; that it is safe to enable the logs in PostgreSQL. The only thing that needs attention is to make sure the log files do not fill up the storage.&lt;/DIV&gt;</description>
    <pubDate>Fri, 06 Nov 2020 12:06:51 GMT</pubDate>
    <dc:creator>Zareh_T</dc:creator>
    <dc:date>2020-11-06T12:06:51Z</dc:date>
    <item>
      <title>How to enable and collect the PostGres SQL database logs</title>
      <link>https://community.qlik.com/t5/Official-Support-Articles/How-to-enable-and-collect-the-PostGres-SQL-database-logs/ta-p/1712186</link>
      <description>&lt;P&gt;There may be situations where the &amp;nbsp;QlikSense repository PostgreSQL database stops responding due to a large number of connections. It may start facing timeout or performance issues.&lt;/P&gt;
&lt;P&gt;At this stage, it may become necessary to look into the database logs in addition to the QlikSense logs. Same would apply to the &amp;nbsp;NPrinting PostgreSQL database.&lt;/P&gt;
&lt;OL&gt;
&lt;LI&gt;Open the Windows Services Console&lt;/LI&gt;
&lt;LI&gt;Stop the Qlik Sense Repository Database Service&lt;BR /&gt;&lt;BR /&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="PostgreSQL_Logging01_StopServices.png" style="width: 999px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/43702iB74238C5771E96CC/image-size/large?v=v2&amp;amp;px=999" role="button" title="PostgreSQL_Logging01_StopServices.png" alt="PostgreSQL_Logging01_StopServices.png" /&gt;&lt;/span&gt;
&lt;P&gt; &lt;/P&gt;
&lt;/LI&gt;
&lt;LI&gt;In a File Explorer, navigate to&amp;nbsp;&lt;FONT face="courier new,courier"&gt;C:\ProgramData\Qlik\Sense\Repository\PostgreSQL\9.6\&lt;/FONT&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;SPAN style="font-family: inherit;"&gt;&lt;SPAN style="font-family: inherit;"&gt;Open&amp;nbsp;&lt;FONT face="courier new,courier"&gt;postgresql.conf&lt;/FONT&gt;&amp;nbsp;in a text editor of your choice.&lt;BR /&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="PostgreSQL_Logging02_Postgresqlconfigfile.png" style="width: 999px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/43703i77C01004D5BE47A2/image-size/large?v=v2&amp;amp;px=999" role="button" title="PostgreSQL_Logging02_Postgresqlconfigfile.png" alt="PostgreSQL_Logging02_Postgresqlconfigfile.png" /&gt;&lt;/span&gt;
&lt;P&gt; &lt;/P&gt;
&lt;/LI&gt;
&lt;LI&gt;&lt;SPAN style="font-family: inherit;"&gt;&lt;SPAN style="font-family: inherit;"&gt;In this configuration file, locate the section&amp;nbsp;ERROR REPORTING AND LOGGING and modify it as follows:&lt;BR /&gt;&lt;BR /&gt;Remove the # in front of the logging configuration settings to enable them.&amp;nbsp;&lt;BR /&gt;Switch &lt;FONT face="courier new,courier"&gt;logging_collector = off&lt;/FONT&gt; to &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;FONT face="courier new,courier"&gt;logging_collector = on&lt;/FONT&gt;&lt;SPAN style="font-family: inherit;"&gt;&lt;SPAN style="font-family: inherit;"&gt;&lt;BR /&gt;&lt;BR /&gt;An example of the changed file can be seen below. Note we do not change any default values in our example.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;As we are not making any changes, the logs will be located in:&lt;BR /&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;C:\ProgramData\Qlik\Sense\Repository\PostgreSQL\9.6\pg_log&lt;/FONT&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;LI-CODE lang="markup"&gt;#---------------------------------------------
# ERROR REPORTING AND LOGGING
#---------------------------------------------

# - Where to Log -

log_destination = 'stderr'   # Valid values are combinations of
                             # stderr, csvlog, syslog, and eventlog,
                             # depending on platform.  csvlog
                             # requires logging_collector to be on.


# This is used when logging to stderr:
logging_collector = on       # Enable capturing of stderr and csvlog
                             # into log files. Required to be on for
                             # csvlogs.
                             # (change requires restart)


# These are only used if logging_collector is on:
log_directory = 'pg_log'     # directory where log files are written,
                             # can be absolute or relative to PGDATA


log_filename = 'postgresql-%Y-%m-%d_%H%M%S.log' # log file name pattern,
                                        # can include strftime() escapes

log_file_mode = 0600            # creation mode for log files,
                                # begin with 0 to use octal notation

log_truncate_on_rotation = off  # If on, an existing log file with the
                    # same name as the new log file will be
                    # truncated rather than appended to.
                    # But such truncation only occurs on
                    # time-driven rotation, not on restarts
                    # or size-driven rotation.  Default is
                    # off, meaning append to existing files
                    # in all cases.

log_rotation_age = 1d  # Automatic rotation of logfiles will
                    # happen after that time.  0 disables.

log_rotation_size = 10MB  # Automatic rotation of logfiles will
                    # happen after that much log output.
                    # 0 disables.&lt;/LI-CODE&gt;&lt;SPAN style="font-family: inherit;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/LI&gt;
&lt;LI&gt;Start the Qlik Sense Repository Database Service&lt;BR /&gt;&lt;BR /&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="PostgreSQL_Logging03_StartServices.png" style="width: 999px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/43706i1CD345CEA86F7E76/image-size/large?v=v2&amp;amp;px=999" role="button" title="PostgreSQL_Logging03_StartServices.png" alt="PostgreSQL_Logging03_StartServices.png" /&gt;&lt;/span&gt;
&lt;P&gt; &lt;/P&gt;
&lt;/LI&gt;
&lt;LI&gt;Once the service has started, verify that logging has been correctly turned on by navigating to&amp;nbsp;&lt;FONT face="courier new,courier"&gt;C:\ProgramData\Qlik\Sense\Repository\PostgreSQL\9.6\pg_log&lt;/FONT&gt;.&lt;BR /&gt;&lt;BR /&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="PostgreSQL_Logging04_LogFile.png" style="width: 999px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/43707iAF7E91E6F142EC43/image-size/large?v=v2&amp;amp;px=999" role="button" title="PostgreSQL_Logging04_LogFile.png" alt="PostgreSQL_Logging04_LogFile.png" /&gt;&lt;/span&gt;&lt;/LI&gt;
&lt;/OL&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;H4&gt;&lt;STRONG&gt;Notes: &lt;/STRONG&gt;&lt;/H4&gt;
&lt;P&gt;Will there be a performance impact by enabling PostgreSQL logging?&lt;BR /&gt;&lt;BR /&gt;R&amp;amp;D did some testing with the following settings:&lt;/P&gt;
&lt;DIV style="margin-left: 40px;"&gt;&lt;LI-CODE lang="markup"&gt;in the postgresql.conf file:
log_destination = 'csvlog'
logging_collector = on
log_connections = on
log_disconnections = on
log_hostname = on
log_statement = 'all'
log_line_prefix = '%a%%%u%%%s'&lt;/LI-CODE&gt;&lt;/DIV&gt;
&lt;P&gt;&amp;nbsp;&lt;BR /&gt;R&amp;amp;D's statement from their testing:&lt;/P&gt;
&lt;DIV style="margin-left: 40px;"&gt;&lt;STRONG&gt;Average response time:&lt;/STRONG&gt;&lt;BR /&gt;Slightly higher with logging enabled but the biggest difference was only 4ms. Average time without logging 163ms, with logging 166ms.&lt;BR /&gt;&lt;BR /&gt;&lt;STRONG&gt;Processor time:&lt;/STRONG&gt;&lt;BR /&gt;PostgreSQL used very little CPU time. Average time without logging was 0.29%, with logging 0.33%.&lt;BR /&gt;&lt;BR /&gt;&lt;STRONG&gt;Memory usage:&lt;/STRONG&gt;&lt;BR /&gt;Here, slightly less memory was used with logging enabled. Average without logging 1.16GB, with logging 1.13GB.&lt;BR /&gt;&lt;BR /&gt;&lt;STRONG&gt;Log files on disk:&lt;/STRONG&gt;&lt;BR /&gt;With logging enabled, a number of files were created on the local disk. About 10MB of data were created every minute.&lt;BR /&gt;&lt;BR /&gt;&lt;STRONG&gt;The conclusion from the tests:&lt;/STRONG&gt; that it is safe to enable the logs in PostgreSQL. The only thing that needs attention is to make sure the log files do not fill up the storage.&lt;/DIV&gt;</description>
      <pubDate>Fri, 06 Nov 2020 12:06:51 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Official-Support-Articles/How-to-enable-and-collect-the-PostGres-SQL-database-logs/ta-p/1712186</guid>
      <dc:creator>Zareh_T</dc:creator>
      <dc:date>2020-11-06T12:06:51Z</dc:date>
    </item>
    <item>
      <title>Re: How to enable and collect the PostGres SQL database logs</title>
      <link>https://community.qlik.com/t5/Official-Support-Articles/How-to-enable-and-collect-the-PostGres-SQL-database-logs/tac-p/2499560#M15184</link>
      <description>&lt;P&gt;Hello&amp;nbsp;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/16102"&gt;@Zareh_T&lt;/a&gt;&amp;nbsp;, I have Qlik Sense Bundelded PostgreSQL 14, (Qlik Sense Feb 2024) and I want to Enbale&amp;nbsp;PostgreSQL Audit Extension (pgAudit). What Steps I need to follow to enable the pgAudit.&lt;/P&gt;
&lt;P&gt;Currently I have the&amp;nbsp;shared_preload_libraries= ' ' - in PostgreSQL conf file.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 30 Dec 2024 10:41:18 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Official-Support-Articles/How-to-enable-and-collect-the-PostGres-SQL-database-logs/tac-p/2499560#M15184</guid>
      <dc:creator>atiwari</dc:creator>
      <dc:date>2024-12-30T10:41:18Z</dc:date>
    </item>
    <item>
      <title>Re: How to enable and collect the PostGres SQL database logs</title>
      <link>https://community.qlik.com/t5/Official-Support-Articles/How-to-enable-and-collect-the-PostGres-SQL-database-logs/tac-p/2499733#M15191</link>
      <description>&lt;P&gt;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/28597"&gt;@Sonja_Bauernfeind&lt;/a&gt;&amp;nbsp;Could you please review this and suggested the Option to enable the pgAudit in Qlik Sense bundled PostgreSQL 14.&lt;/P&gt;</description>
      <pubDate>Thu, 02 Jan 2025 12:39:35 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Official-Support-Articles/How-to-enable-and-collect-the-PostGres-SQL-database-logs/tac-p/2499733#M15191</guid>
      <dc:creator>atiwari</dc:creator>
      <dc:date>2025-01-02T12:39:35Z</dc:date>
    </item>
  </channel>
</rss>

