Skip to content

Commit 2cee36f

Browse files
committed
update eventdb and postgresql documentation
update to current version notes on distributed setups: networking, permissions installation: refer to upstream database: template and encoding
1 parent 803f9f6 commit 2cee36f

File tree

2 files changed

+14
-20
lines changed

2 files changed

+14
-20
lines changed

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
- Add a deprecation warning (PR#2544 by Sebastian Wagner)
4343

4444
### Documentation
45-
- `docs/admin/installation/linux-packages`: Add `[signed-by=]` options, add wget command as alternative to curl
45+
- `docs/admin/installation/linux-packages`: Add `[signed-by=]` options, add wget command as alternative to curl (PR#2547 by Sebastian Wagner).
4646

4747
### Packaging
4848

docs/admin/database/postgresql.md

Lines changed: 13 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -15,20 +15,15 @@ You have two basic choices to run PostgreSQL:
1515

1616
1. on the same machine as intelmq, then you could use Unix sockets if available on your platform
1717
2. on a different machine. In which case you would need to use a TCP connection and make sure you give the right
18-
connection parameters to each psql or client call.
18+
connection parameters to each psql or client call. On the networking side, make sure the connections are allowed, postgresql-server is listening on the correct interface and the user is allowed to connect (`pg_hba.conf`).
1919

20-
Make sure to consult your PostgreSQL documentation about how to allow network connections and authentication in case 2.
20+
### PostgreSQL Server Version
2121

22-
### PostgreSQL Version
23-
24-
Any supported version of PostgreSQL should work (v>=9.2 as of Oct 2016) [[1]](https://www.postgresql.org/support/versioning/).
25-
26-
If you use PostgreSQL server v >= 9.4, it gives you the possibility to use the time-zone [formatting string](https://www.postgresql.org/docs/9.4/static/images/functions-formatting.html) "OF" for date-times and the [GiST index for the CIDR type](https://www.postgresql.org/docs/9.4/static/images/release-9-4.html#AEN120769). This may be useful depending on how you plan to use the events that this bot writes into the database.
27-
28-
### intelmq_psql_initdb
22+
Any supported version of PostgreSQL should work (v>=13 as of January 2025) [[1]](https://www.postgresql.org/support/versioning/).
23+
### events table definition (`intelmq_psql_initdb`)
2924

3025
IntelMQ comes with the `intelmq_psql_initdb` command line tool designed to help with creating the
31-
EventDB. It creates in the first line:
26+
EventDB tabls. It generates these SQL commands for you:
3227

3328
- A `CREATE TABLE events` statement with all valid IntelMQ fields as columns and correct types
3429
- Several indexes as examples for a good read & search performance
@@ -37,22 +32,21 @@ Having an `events` table as outlined in the SQL file, IntelMQ's SQL Output Bot c
3732

3833
In addition, the script supports some additional features supporting use cases described later in this document:
3934

40-
- `--partition-key` - for generating schema aligned with TimescaleDB or partitioned tables,
41-
- `--separate-raws` - for generating views and triggers needed to `eventdb_raws_table` (works also together with adjustments for partitioning).
35+
- `--partition-key` - for generating schema aligned with TimescaleDB or partitioned tables
36+
- `--separate-raws` - for generating views and triggers needed to `eventdb_raws_table` (works also together with adjustments for partitioning). This can increase the performance by separating data in two tables. See section [Separating raw values in PostgreSQL using view and trigger](#separating-raw-values-in-postgresql-using-view-and-trigger) below for more information.
4237

4338
For a full list of supported parameters, call the script help using `-h` parameter.
4439

4540
All elements of the generated SQL file can be adapted and extended before running the SQL file against a database, especially the indexes. Please review the generated script before applying.
4641

4742
Be aware that if you create tables using another DB user that is used later by the output bot, you may need to adjust ownership or privileges in the database. If you have problems with database permissions,
48-
refer to `PostgreSQL documentation <https://www.postgresql.org/docs/current/ddl-priv.html>`.
43+
refer to [PostgreSQL documentation](https://www.postgresql.org/docs/current/ddl-priv.html).
4944

5045
### Installation
5146

52-
Use `intelmq_psql_initdb` to create initial SQL statements from `harmonization.conf`. The script will create the
53-
required table layout and save it as `/tmp/initdb.sql`
47+
First, install the PostgreSQL on your server using system packages or using any installation variant supported by the project: [PostgreSQL server installation](https://www.postgresql.org/download/)
5448

55-
You need a PostgreSQL database-user to own the result database. The recommendation is to use the name `intelmq`
49+
You need a PostgreSQL database-user to own the resulting database. The recommendation is to use the name `intelmq`
5650
. There may already be such a user for the PostgreSQL database-cluster to be used by other bots. (For example from
5751
setting up the expert/certbund_contact bot.)
5852

@@ -66,16 +60,16 @@ createuser --no-superuser --no-createrole --no-createdb --encrypted --pwprompt i
6660
Create the new database:
6761

6862
```bash
69-
createdb --encoding='utf-8' --owner=intelmq intelmq-events
63+
createdb --encoding='utf-8' --owner=intelmq intelmq-events --template template0
7064
```
7165

72-
(The encoding parameter should ensure the right encoding on platform where this is not the default.)
66+
The encoding parameter should ensure the right encoding on platform where this is not the default. Template `template1` has encoding `SQL_ASCII`, so in order to use UTF8, `template0` is required.
7367

7468
Now initialize it as database-user `intelmq` (in this example a network connection to localhost is used, so you would
7569
get to test if the user `intelmq` can authenticate):
7670

7771
```bash
78-
psql -h localhost intelmq-events intelmq </tmp/initdb.sql
72+
psql -h localhost intelmq-events intelmq < /tmp/initdb.sql
7973
```
8074
## EventDB Utilities
8175

0 commit comments

Comments
 (0)