翻譯:http://ossec-docs.readthedocs.io/en/latest/manual/output/pgsql-database-outout.html
輸出告警到PostgreSQL
資料庫設定
在pgsql中建立ossec使用者
$ sudo -u postgres createuser -D -A -P ossec_user
Enter password for new role:
Enter it again:
Shall the new role be allowed to create more new roles? (y/n) n
CREATE ROLE
建立資料庫
$ sudo -u postgres createdb -O ossec_user ossecdb
CREATE DATABASE
建立必要的表
$ psql -h 127.0.0.1 -U ossec_user -d ossecdb -f postgresql.schema
OSSEC設定
在/var/ossec/etc/ossec.conf添加<database_output>标簽
<ossec_config>
<database_output>
<hostname>192.168.2.30</hostname>
<username>ossecuser</username>
<password>ossecpass</password>
<database>ossec</database>
<type>postgresql</type>
</database_output>
</ossec_config>
啟用資料庫守護程序,并重新啟動ossec,以使更改生效
# /var/ossec/bin/ossec-control enable database
# /var/ossec/bin/ossec-control restart