Help us improve your experience.

Let us know what you think.

Do you have time for a two-minute survey?

Navigation
Guide That Contains This Content
[+] Expand All
[-] Collapse All

    Postgres Log Format

    WebApp Secure uses postgres for its permanent data store. postgres.log contains logs of manipulations on the schema of the database, as well as any errors that occurred during database operations. For more information on postgres, go to http://www.postgresql.org/docs/9.0/static/runtime-config-logging.html . The format of the posgres log file is as follows:

    <date_utc> <hostname> postgres[<pid>] : [<group_id>] <sql_error_code> <session_id> <message_type>: <message>

    Field definitions:

    • <date_utc>–The date and time in UTC.
    • <hostname>–The hostname of the machine.
    • <pid>–The process ID of the postgres instance.
    • <group_id>– A set of two numbers, a major number and a minor number, respectively, that represent a piece of a log. Since postgres logs the statements that generated errors, these statements are issued as separate log lines, and in order to distinguish multiple lines of logs with each other, we look at the time, major group number, and minor group number. For example, if a major group number is 22 and a minor group number is 2, that log entry is the second line of output from a postgres log. To find all other lines that go with this line, look for other lines that were output at the same time with the same major group number. For example, [22-1], [22-3], [22-4] would all be log lines that belong to the line that has [22-2] (provided they happened at the same <date_utc>.
    • <sql_error_code>–The SQL error code. Used with the documented table at http://www.postgresql.org/docs/9.0/static/errcodes-appendix.html which explains each error code and the meaning.
    • <session_id>–A somewhat unique session identifier that can be used to search for specific lines in the log.
    • <message_type>–The type of the message. Can be LOG, WARNING, ERROR, or STATEMENT.
    • <message>–The message.

    Example:

    Feb 24 14:58:08 webappsecure postgres[7694]: [10-1] 42701 530b5e00.1e0e ERROR: column "requests" of relation "sessiongroup" already exists Feb 24 14:58:08 webappsecure postgres[7694]: [10-2] 42701 530b5e00.1e0e STATEMENT: ALTER TABLE sessiongroup ADD COLUMN requests bigint DEFAULT 0; Feb 24 16:52:41 webappsecure postgres[12501]: [48-1] 42703 530b7873.30d5 ERROR: column it.description does not exist at character 35 Feb 24 16:52:41 webappsecure postgres[12501]: [48-2] 42703 530b7873.30d5 STATEMENT: SELECT it.itid, it.code, it.name, it.description FROM incidenttype AS it Mar 4 16:18:00 webappsecure postgres[13931]: [743-1] 01000 5315d18a.366b WARNING: skipping "pg_tablespace" --- only superuser can vacuum it Mar 5 13:12:40 webappsecure postgres[21640]: [20-1] 08P01 531647dc.5488 LOG: unexpected EOF on client connection

    Published: 2014-06-27