# 対象ウェブAccessログ

{% hint style="info" %}

```
 クライアントウェブアクセス(access)ログを“PLURA V5 Log Collectorサーバー”使用して転送する方法

 PLURA Log Collectorサーバー利点はクライアント(Web Server)で暗号化, 圧縮せずにsyslogにすぐ転送するためリソース使用量（CPU、メモリなど）を最小限に抑えることができます。 
```

{% endhint %}

<figure><img src="https://2905490945-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fggd4Oi5rCa2J3EuvDJKc%2Fuploads%2FLE5kRGWKA5Ex9s8Tbtie%2Fimage.png?alt=media&#x26;token=20cfb9b5-dd2a-400c-abb2-786570cbc196" alt=""><figcaption></figcaption></figure>

### 1. クライアント: Apache Httpdウェブ接続ログ生成 <a href="#id-1" id="id-1"></a>

環境: CentOS 7 (64ビット), Rsyslog 8.24.0-57.el7\_9.1<br>

**1-1. rsyslog.conf生成及びremote rsyslogサーバーで転送修正**

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

{% hint style="info" %}

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

 input(type=”imfile”
 File=”/var/log/plura/weblog.log”
 Tag=”httpd”
 Severity=”info”
 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 @PLURA_Log_Collector_Server:514 #UDP
 :programname, isequal, “httpd” stop
```

{% endhint %}

[PLURA V5ウェブロギングパス/var/log/plura/weblog.log](https://docs.plura.io/ja/login)

注意: PLURA V5ウェブログ収集OFF

**1-2. rsyslog restart**

`# service rsyslog restart`<br>

**1-3. サーバー接続debug**

`# nc -zu PLURA_Log_Collector_Server 514`<br>

{% hint style="info" %}

```
 Connection to PLURA_Log_Collector_Server 514 port [udp/syslog] succeeded!
```

{% endhint %}

### 2. サーバーLog Collector <a href="#id-2" id="id-2"></a>

環境 : CentOS 7, Rsyslog 8.2010.0

<br>

**2-1.** [**PLURA Log Collectorサーバーインストール**](https://qubitsec.github.io/ja_logcol_application.html)

<br>

**2-2. Remote クライアントのsyslog転送オープン**

`# firewall-cmd –add-port 514/udp`

`# firewall-cmd –reload`

<br>

**2-3. 77-plura.conf修正**

`# vi /etc/rsyslog.d/77-plura.conf`

{% hint style="info" %}

```
 $template CEETemplate, “%msg:2:$:%\n”

 # Provides UDP syslog reception
 $ModLoad imudp
 $UDPServerRun 514
```

{% endhint %}

**2-4. 99-plura.conf修正**

`# vi /etc/rsyslog.d/99-plura.conf`

{% hint style="info" %}

```
 $template DynaFile, “/var/log/plura/weblog-%FROMHOST-IP%.log”
 *.* -?DynaFile;CEETemplate
```

{% endhint %}

**2-5. rsyslog restart**

`# service rsyslog restart`

<br>

**2-6. パスにファイル受信可否確認**

`# ls -al /var/log/plura/`

<br>

**2-7. Log Collector登録**

パス : システム > システム管理 > ログ取り込みサーバー(親)選択 > 収集環境選択

<figure><img src="https://2905490945-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fggd4Oi5rCa2J3EuvDJKc%2Fuploads%2F6eeBqv08g7Dx67B3AXBX%2Fimage.png?alt=media&#x26;token=d4cf806a-b4a0-425c-9489-fd552f3a657a" alt=""><figcaption></figcaption></figure>

### 外部参考サイト <a href="#id-3" id="id-3"></a>

<https://rsyslog.readthedocs.io/en/latest/configuration/modules/imfile.html>
