# Apache httpd error

{% hint style="info" %}
Apache httpd errorログ収集方法のご案内
{% endhint %}

### 1. conf 設定(rsyslog 使用) <a href="#id-1" id="id-1"></a>

* 80-htpd.conf > conf ファイルを生成する

```
# cd /etc/rsyslog.d/
# vi /etc/rsyslog.d/80-httpd.conf
```

### 2. confファイルの作成 <a href="#id-2" id="id-2"></a>

```
File = "ログ 経路", Tag = "タグ", Severity = "深刻度", programname ="プログラム名"
```

<pre class="language-bash"><code class="lang-bash"><strong>vi /etc/rsyslog.d/80-httpd.conf
</strong></code></pre>

```
#variables required for non-syslog log file forwarding – httpd error log file
#edit on your location

input(type=”imfile”
File=”/var/log/httpd/error_log”
Tag=”httpd”
Severity=”error”
Facility=”local7″)

###### Creates a template for each log file in the Logentries UI
### logic to apply the relevant templates to the different log files

if $programname == ‘httpd‘ then /var/log/plura/ceelog-127.0.0.1.log;CEETemplate
:programname, isequal, ‘httpd‘ stop
```

**2-1. repoからダウンロードする**

```bash
wget https://repo.plura.io/v5/module/rsyslog/80-httpd.conf
```

```bash
curl https://repo.plura.io/v5/module/rsyslog/80-httpd.conf -o /etc/rsyslog.d/80-httpd.conf
```

### 3. rsyslog デーモン再起動 <a href="#id-3" id="id-3"></a>

```bash
service rsyslog restart
```

### 4. 探知確認 <a href="#id-4" id="id-4"></a>

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

<figure><img src="https://2905490945-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fggd4Oi5rCa2J3EuvDJKc%2Fuploads%2FclAphbyf5htz7SralhYL%2Fimage.png?alt=media&#x26;token=8d00cc58-b731-4289-9b14-5e2f781a272e" alt=""><figcaption></figcaption></figure>

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

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

### 参考サイト <a href="#id-5" id="id-5"></a>

> <https://www.rsyslog.com/doc/v8-stable/configuration/modules/imfile.html>
