# PostgreSQL

## CentOS <a href="#id-1" id="id-1"></a>

### 1. postgresql.conf 修整 <a href="#id-1-1" id="id-1-1"></a>

```
> 辞書Syslogのインストールが必要
> Config 位置確認

[config 経路例] /var/lib/pgsql/9.6/data/postgresql.conf
[修正例] # ERROR REPORTING AND LOGGING 下段から修正
log_destination = ‘stderr’ ラインを注釈処理
log_destination = ‘syslog’ ライン追加

# These are relevant when logging to syslog: 下段の次の4ライン注釈解除
#syslog_facility = ‘LOCAL0’
#syslog_ident = ‘postgres’
#syslog_sequence_numbers = on
#syslog_split_messages = on
```

### 2. PostgreSQLおよびSyslog再起動 <a href="#id-1-2" id="id-1-2"></a>

* バージョンによってサービス名が異なりますので、バージョンの確認

<pre class="language-bash"><code class="lang-bash"><strong>psql –version
</strong></code></pre>

```
[バージョン出力例] psql (PostgreSQL) 9.6.15
[サービス名確認パス例] /etc/systemd/system/multi-user.target.wants/postgresql-9.6.service
[上記の例で確認されたバージョンによる再起動例] service postgresql-9.6 restart
```

<pre class="language-bash"><code class="lang-bash"><strong>service rsyslog restart
</strong></code></pre>

### 3.ログ確認 <a href="#id-1-3" id="id-1-3"></a>

* ログ例 : 全体ログ > ホスト

<figure><img src="/files/VCPVgFBnxlPL6WVGg9D0" alt=""><figcaption></figcaption></figure>

* [x] 上記の内容を活用してフィルターを登録すると、探知ログを確認することができます。

> [https://docs.plura.io/ja/fn/comm/filter/syslog](https://docs.plura.io/ja/function/common/filter/syslog)

***

## Ubuntu <a href="#id-2" id="id-2"></a>

### 1. postgresql.conf 修整 <a href="#id-2-1" id="id-2-1"></a>

```
> 辞書Syslogのインストールが必要
> Config 位置確認

 [config 経路例] /var/lib/pgsql/9.6/data/postgresql.conf
 [修正例] # ERROR REPORTING AND LOGGING 下段から修正
 log_destination = ‘stderr’ ラインを注釈処理
 log_destination = ‘syslog’ ライン追加

 # These are relevant when logging to syslog: 下段の次の4ライン注釈解除
 #syslog_facility = ‘LOCAL0’
 #syslog_ident = ‘postgres’
 #syslog_sequence_numbers = on
 #syslog_split_messages = on
```

### 2.  PostgreSQLおよびSyslog再起動 <a href="#id-2-2" id="id-2-2"></a>

```
systemctl restart postgresql
service rsyslog restart
```

### 3. ログ確認 <a href="#id-2-3" id="id-2-3"></a>

* ログ例 : 全体ログ > ホスト

<figure><img src="/files/u8OpOBu1OEjwLCheD2JR" alt=""><figcaption></figcaption></figure>

* [x] 上記の内容を活用してフィルターを登録すると、探知ログを確認することができます。

> [https://docs.plura.io/ja/fn/comm/filter/syslog](https://docs.plura.io/ja/function/common/filter/syslog)


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.plura.io/ja/agents/siem/uplc/postgresql.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
