> For the complete documentation index, see [llms.txt](https://manual.seara.biz/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://manual.seara.biz/connect-to-seara-with/how-to-setup-equipment-connect-to-seara/internet-traffic-log.md).

# Internet Traffic Log

ระบบการส่ง Log จาก Microtik ไปเก็บยังระบบ Cloud ของ Seara จะประกอบไปด้วย Logfile 2 ส่วน คือ

* **Hotspot Log** คือ Log file ที่มีการเก็บค่า การเข้าใช้งานของผู้ใช้งาน คือ Login , Logout และ ข้อมูลทางเครือข่ายที่ระบบ IP Address และ MAC Addess ของผู้ใช้งานนั้นๆ&#x20;
* **Firewall Log** คือ Log ที่มีการเก็บค่า Internet Traffic จากการเข้าใช้งาน Internet ของผู้ใช้งาน โดยจะเป็น Log มาตรฐานที่ระบุข้อมูล IP Adress ต้นทาง ปลายทาง , Port และ Protocol ที่ใช้งาน

โดยจะต้องตั้งค่าการส่ง Log ทั้ง 2 รูปแบบให้ถูกต้องตามรูปแบบที่กำหนดโดยมีขั้นตอนดังนี้

## 1. ตั้งค่ารูปแบบการส่ง Hotspot Login , Logout

<mark style="color:orange;">**IP -> Hotspot -> UserProfile -> Hotspot User Profile ->Script**</mark>

&#x20;  &#x20;

<figure><img src="/files/QlNpFmlEdKpJQsVCHjGp" alt=""><figcaption><p>ขั้นตอนการตั้งค่า Script ของ Hotspot Profile</p></figcaption></figure>

{% tabs %}
{% tab title="OnLogin: " %}
:local whouser $user;

:local whoip $address;

:local macaddr \[/ip hotspot active get \[find user=$whouser] mac-address];

:log info ("User Login: ".$whouser." IP: ".$whoip." MAC: ".macaddr);
{% endtab %}

{% tab title="OnLogout:" %}
:log info ("User Logout: ".$user);
{% endtab %}
{% endtabs %}

## 2. ตั้งค่า SysLog  Server สำหรับส่ง Internet Traffic&#x20;

<mark style="color:orange;">**System -> Logging -> Action**</mark>

<figure><img src="/files/Gt54aoWofscEwfIm5kyo" alt=""><figcaption><p>การตั้งค่า Syslog Server</p></figcaption></figure>

&#x20;    **Name:** SearaLog&#x20;

&#x20;    **Type:** remote

&#x20;    **Remote Address:** ค่า IP Address ของ Syslog Server (เช็คจาก Email ที่ได้รับ)

&#x20;    **Remote Port:**  ค่า IP Address ของ Syslog Server  (เช็คจาก Email ที่ได้รับ)

## 3. ตั้งค่าการส่ง Internet Traffic Log

<mark style="color:orange;">**System -> Logging -> Rule**</mark>

<figure><img src="/files/8TxFILCEwbss81LgQ6tB" alt=""><figcaption><p>การตั้งค่า Logging Rule</p></figcaption></figure>

เป็นการกำหนดให้ส่ง hotspot log ,DHCP Lease Log และ firewall Log ไปยัง Syslog server ที่ได้มีการตั้งค่าไว้ในข้อ 2

&#x20;**Rule1:**       hotspot, script,account สำหรับส่งข้อมูลการ Login ,Logout ของ User

&#x20;**Rule2:**      firewall,info สำหรับส่งข้อมูล Internet Traffic ที่ User ใช้งาน

&#x20;**Rule3:**     script, info สำหรับส่งข้อมูล DHCP Lease&#x20;

{% tabs %}
{% tab title="Rule 1" %}
![](/files/94YWMwfwcsXSJuc2ZMj3)
{% endtab %}

{% tab title="Rule2" %}
![](/files/Ry9nEl35ZZc5WG3nZZnd)
{% endtab %}

{% tab title="Rule 3" %}
![](/files/wyAhhiV5kIGcPawjWSAE)
{% endtab %}
{% endtabs %}

&#x20;   ทุกรูปแบบการส่ง Log ให้กำหนดรูปแบบ Prefix ดังนี้

·                       **SEARA--( MAC Address ของอุปกรณ์ ที่ใส่ใน NAS)**&#x20;

&#x20;                        <mark style="color:orange;">**ตัวอย่าง**</mark> **SEARA--E6:B5:0E:45:BD:A3** &#x20;

\*\*ข้อควรระวัง คำว่า <mark style="color:red;">**SEARA ต้องเป็นตัวพิมใหญ่ และตามด้วย - จำนวน 2 ชุดติดกัน (--) หากตั้งค่าไม่ถูกต้อง Syslog จะไม่รับข้อมูลดังกล่าวเข้าไปเก็บในระบบ**</mark>

โดย Action: ให้เลือกเป็น SearaLog ที่สร้างไว้ในข้อ 2 เพื่อบอกให้ Microtik ส่งไปเก็บข้อมูลที่ Syslog Server

## 4. กำหนด Log Rule สำหรับส่ง Internet Traffic Log&#x20;

<mark style="color:orange;">**IP --> Firewall --> Filter Rules-> + (เพิ่มRule ใหม่)**</mark>

<figure><img src="/files/x8BtluzMQW7hjdE1x2fJ" alt=""><figcaption><p>การตั้งค่า Firewall Rule สำหรับ Log</p></figcaption></figure>

&#x20;    ให้ตั้งค่าการส่ง Log ที่ Tab General และ Action ดังนี้

{% tabs %}
{% tab title="General" %}
Chain:Forward

Out Interface: WAN

Connection State: established&#x20;
{% endtab %}

{% tab title="Action" %}
Action: Log
{% endtab %}
{% endtabs %}

การตั้งค่าดังกล่าวเป็นการกำหนดให้ Traffic Firewall สำหรับ Forward Chain (Chain ที่อนุญาติให้ผู้ใช้งานออก Internet ส่ง Log การเข้าใช้งาน Internet ไปยังระบบ Log ซึ่งมีการตัังค่าให้ส่งไปยัง Syslog Server ตามข้อ 2

##


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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://manual.seara.biz/connect-to-seara-with/how-to-setup-equipment-connect-to-seara/internet-traffic-log.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.
