# MySQL

{% hint style="info" %}
MySQL(CentOS) 로그 분석
{% endhint %}

### 1. mysql.conf 다운로드 rsyslog 사용 <a href="#id-1" id="id-1"></a>

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

### 2. 80-mysql.conf 수정 <a href="#id-2" id="id-2"></a>

* mysql error 로그 위치 확인

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

### 3. rsyslog 데몬 재시작 <a href="#id-3" id="id-3"></a>

```bash
service rsyslog restart
```

### 4. 탐지 확인 <a href="#id-4" id="id-4"></a>

* 로그 예시 : [전체로그 > 호스트](https://docs.plura.io/ko/function/common/flog/host)

<figure><img src="https://qubitsec.github.io/docs/images/Ins_G/Mysql(cent)log/1.png" alt="" width="563"><figcaption></figcaption></figure>

* [x] 위 내용을 활용해서 필터를 등록하면 탐지로그를 확인할 수 있습니다.

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