# Application log(PLC)

> アプリケーションログの中で特別なキーワードをリアルタイムで検出したい場合はどうすればよいですか？ たとえば、以下のようなアプリケーションログの中で、2020010100037キーワードをリアルタイムで検出する場合です。

### 1. 収集されたログを確認する <a href="#id-1" id="id-1"></a>

<figure><img src="https://qubitsec.github.io/docs/images/Ins_G/rsyslog/1.png" alt=""><figcaption></figcaption></figure>

### 2. conf設定（rsyslog使用） <a href="#id-2" id="id-2"></a>

* 80-application.conf → confファイルの作成

```bash
vi /etc/rsyslog.d/80-application.conf
```

### 3. conf ファイル生成例 <a href="#id-3" id="id-3"></a>

* File = "ログパス"、"Tag = "ログタグ"、"Severity = "深刻度"
* ファイル名にワイルドカードを使用する必要がある場合は、rsyslogバージョン8.25以上を使用してください。

<pre><code># variables required for non-syslog log file forwarding – application log file #edit on your location
input(type=”imfile” File=”/var/log/application.log” Tag=”application” Severity=”info” Facility=”local7″)
<strong>
</strong><strong>### Creates a template for each log file in the Logentries UI 
</strong><strong>### logic to apply the relevant templates to the different log files
</strong>if $programname == “application” then /var/log/plura/ceelog-127.0.0.1.log;CEETemplate 
:programname, isequal, “application” ~
</code></pre>

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

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

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

```bash
service rsyslog restart
```

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

* 全体ログ > ホスト > 主要オブジェクトカラムでアプリケーションを確認

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

### 6. リアルタイム検出フィルター登録 <a href="#id-6" id="id-6"></a>

* 2020010100037 キーワードに対するリアルタイム検出登録フィルタ
* フィルター > 登録フィルター > ホスト/ウェブ/ウェブファイアウォール > 登録
* フィルター登録下段 > 情報入力 > msg > 2020010100037登録

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

### 7. 最新のrsyslogインストール <a href="#id-7" id="id-7"></a>

```bash
cp /etc/yum.repos.d/rsyslog.repo /etc/yum.repos.d/rsyslog.repo.old
curl -s http://rpms.adiscon.com/v8-stable/rsyslog.repo -o /etc/yum.repos.d/rsyslog.repo
yum -y install rsyslog
yum list rsyslog
rsyslogd -version

rsyslogd 8.2012.0 (aka 2020.12) compiled …
```

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

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


---

# 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/application-log-plc.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.
