ossc-db / pgaudit

PostgreSQL Audit Extension
Other
2 stars 4 forks source link

(refactored branch) Setting file error does not occur even if the order of each section is changed. #30

Closed harada-toshi closed 7 years ago

harada-toshi commented 7 years ago

Overview

Setting file error does not occur even if the order of each section is changed. In Readme.md it is explained as follows.

The settings are divided into sections where you can set some parameters to control pgaudit. They are "output", "option" and "rule" sections, and should be arranged this order in the file.

However, in the current version, even if you write the option section before the output section, it will not result in an error. Is it a bug on the program side or an error in the description in Readme.md?

config file sample

[option]
    role = 'auditor'

[output]
    logger = 'serverlog'

[rule]
        format = '%t,%d,%u,%p,%v,%statement_id,%sub_statement_id,%class,%command_tag,%object_type,%object_id,%command_text'
        class='READ,WRITE,DDL,ROLE,FUNCTION,MISC'

PostgreSQL launch log

$ more 04-6-02.log
$ pg_ctl -w start -D ~/pgdata/9.6-pgaudit/
waiting for server to start....LOG:  log_catalog = 1
LOG:  log_level_string = (null)
LOG:  log_level = 15
LOG:  log_parameter = 0
LOG:  log_statement_once = 0
LOG:  log_for_test = 0
LOG:  role = auditor
LOG:  logger = serverlog
LOG:  facility = (null)
LOG:  priority = (null)
LOG:  ident = (null)
LOG:  option = (null)
LOG:  pathlog = (null)
LOG:  Rule 0
LOG:      BMP class = 500
LOG:  pgaudit extension initialized
}LOG:  database system was shut down at 2017-02-22 16:07:01 JST
LOG:  MultiXact member wraparound protections are now enabled
LOG:  database system is ready to accept connections
LOG:  autovacuum launcher started
LOG:  connection received: host=[local]
LOG:  connection authorized: user=nuko database=postgres
FATAL:  role "nuko" does not exist
 done
server started
harada-toshi commented 7 years ago

Similar problems

Describing a section in the following order does not cause an error.

Perhaps the current version does not check the description order of sections.

MasahikoSawada commented 7 years ago

Thank you for the report! Commit c4dc135740b02f8841eb62d46b44d611c9be0097 should fix first one.

Perhaps the current version does not check the description order of sections.

Yes, since the order of each section doesn't matter of pgaudit behavior, I'd changed it. It might be different from advanced one, should we change this as well?

harada-toshi commented 7 years ago

From the usability point of view, the "advanced branch" feels that syntax checking is (unnecessarily) strict. In the refactored version, we think that it is better to rewrite Readme.md according to the current behavior.

harada-toshi commented 7 years ago

The same applies to issue #29 Based on the current version of the behavior, we believe that it is sufficient to modify the Readme.md.

MasahikoSawada commented 7 years ago

Yeah, I agree with you. Commit 77ef728161e6b66f38a99aacc913f11163015d26 should fix this, please confirm it.

harada-toshi commented 7 years ago

Thanks! I confirmed the description of Readme.md. I think there is no problem.

MasahikoSawada commented 7 years ago

Thank you for confirmation. Close.