DOCUMENTATION

5651 log server

Turkish Law 5651 requires a public Wi-Fi operator to keep traffic records and to prove they were not altered. The log server collects your firewall's traffic logs over syslog, links them to the guest who held the address, seals every day with a signature or a KamuSM timestamp and keeps it for at least two years.

The log server is part of the on-premise installation only: the logs never leave your own server, and Cloud has no such menu. It appears as the Log Server group in the side menu for Admins; other roles do not see it. The pages below are described in words because they cannot be shown in the Cloud demo.

How it works

  • A separate service, captivo-logd, listens for syslog on port 514, UDP and TCP, and does the receiving, parsing, nightly signing and deletion. The web panel only reads and configures.
  • Every line is stored verbatim. That raw log is the legal record: it is what gets signed and retained, whether or not Captivo understands the line.
  • Lines from known devices are also parsed into events (source, destination, port, action) so they can be searched. Parsers exist for pfSense / OPNsense (filterlog), MikroTik, FortiGate, Cisco Meraki, UniFi and Ruijie, plus pfSense captive-portal and DHCP lines and RouterOS hotspot and DHCP lines. Events belong to one of four types: traffic, DHCP, authentication and DNS.

1. Send the firewall's logs to Captivo

Replace <CAPTIVO_IP> with the Captivo server's address; the port is 514 on every device. Send only the categories that carry network events. Everything the device logs about itself (cron, the web interface, gateway monitoring) is stored too, costs disk and adds nothing to the record.

  • pfSense: Status → System Logs → Settings, tick Send log messages to remote syslog server, enter <CAPTIVO_IP>:514 and select Firewall Events, DHCP Events and Captive Portal Events. Do not choose Everything.
  • OPNsense: System → Settings → Logging / targets, add a target with transport UDP, applications filter, dhcpd and captiveportal, the Captivo address and port 514.
  • MikroTik: add the topics one by one; a broad rule such as topics=info sends every internal message. Check the router's NTP and time zone, or the timestamps will not line up with sessions.
RouterOS
/system logging action add name=captivo target=remote remote=<CAPTIVO_IP> remote-port=514
/system logging add topics=firewall action=captivo
/system logging add topics=dhcp action=captivo
# only if you use the hotspot:
/system logging add topics=hotspot action=captivo

Port 514 on the Captivo server must be reachable from the firewall; open it on any firewall in between.

2. Log Sources

There is no "add source" button. The first syslog line from a new address creates a row under Log Server → Log Sources by itself, and within a few minutes the firewall appears. The page opens with five ingest cards for the last 15 minutes: Lines per second (and the busiest minute), Received in the last 15 minutes, Dropped lines (red above zero: those lines were never stored), Parse queue (amber above 1,000) and Write errors (held in an on-disk queue and retried; nothing is lost). Below them is one row per source:

ColumnMeaning
Label, Log Source IPThe name and the sending address; one row per address.
Device Type, Statusauto: recognised by itself. pinned: you chose the parser. unknown: not recognised yet. A Disabled badge is shown on top.
Last SeenWhen the last line arrived.
Raw, Events (7 days)Line and event counts for the last seven days only, refreshed about once a minute. Search, signing and retention cover the whole period.
Parser, % unrecognisedThe share of lines Captivo could not parse, amber above 5%, linking to the Unrecognised Lines page. With fewer than 200 lines it says there is too little data for a ratio.

Assign a parser, disable, delete

  • A source in the unknown state shows a drop-down and Assign: pfSense / OPNsense (filterlog), MikroTik, FortiGate, Cisco Meraki, UniFi or Ruijie. The choice is pinned and every stored line of that source is queued to be parsed again, so older lines become searchable too. The pfSense captive-portal and DHCP parsers and the RouterOS hotspot and DHCP parsers are chosen by Captivo itself and cannot be assigned by hand.
  • Disable stops the source for real: within about 15 seconds its lines are dropped when they arrive, so they are neither stored, parsed nor signed. The page does not say so. Disable a source only when you truly never want its logs; for a noisy device, switch categories off on the device instead. Enable turns it back on, but lines sent in between are gone.
  • Delete asks for confirmation and removes the source with all its raw logs and events. It is refused for a source whose logs are part of signed days, because that would break the evidence chain; disable it instead.

The Unrecognised Lines page (from the percentage link) groups the last seven days' unparsed lines by program, top 20, with a sample line each. Known noise such as cron, newsyslog, minicron and check_reload_status is badged known noise and a few gateway-monitoring programs are badged planned; both are stored but left out of the percentage. The programs without a badge tell you which syslog categories to switch off or which device to assign a parser to. Unparsed lines are still in the raw log and still signed.

If something is missing, see no logs arrive at the 5651 log server.

Raw Logs

Raw Logs shows the verbatim lines, the legal record, including those no parser understood. Filter by text inside the line, by source and by from and to dates; with no dates it starts at yesterday. Each row has the received time, the source, a Parsed Yes or No badge and the line. It pages 100 at a time, counts only up to 10,000 (it then says 10,000+ and asks you to narrow the range) and has no export. The lines are shown in full to Admins, with no masking.

Log Search and the query language

Log Server → Log Search has one query box and a time window. Type a query and press Search; the box checks the syntax as you type, underlines the mistake and suggests a field ("Did you mean …?"). Chips under the box insert common fields and field names autocomplete. An empty query lists the most recent records of the window. The window picker offers the last hour, 6 hours, 24 hours (default), 3 days and 7 days; seven days is the maximum, and a longer one is refused.

Examples
source.ip:10.20.0.0/24 AND event.action:block
destination.port:(80,443) AND captivo.event.family:traffic
destination.port:[8000..8100] OR destination.port>=50000
source.mac:AA:BB:CC:* NOT destination.port:53
dns.question.name:*example* AND captivo.event.family:dns
host.name:/^laptop-[0-9]+$/
captivo.guest:5321234567
"connection refused"
  • Terms: field:value, or a comparison with no colon: destination.port>=1024; !=, <, <= and > work too.
  • Logic: AND, OR, NOT in any letter case, a leading - as NOT, and parentheses. Two terms side by side mean AND. NOT binds tighter than AND, AND tighter than OR.
  • Values: a plain value, "quoted" text, * alone (the field exists), abc* (starts with), *abc* (contains), a list (a,b,c), a range [a..b], an IPv4 network such as 10.0.0.0/24 and a regular expression between slashes (200 characters at most). A value reads up to the next space, so MAC addresses need no quotes.
  • Free text: a bare word or a quoted phrase searches the raw line, ignoring case and Turkish accents. Used together with field terms it is only searched in lines that could be parsed, and the page says so.
  • Which operators a field accepts depends on its type: addresses take equals, not-equals, network and exists; numbers add the comparisons, ranges and lists; MACs add a prefix; text adds prefix, contains, regular expression and lists. A wrong one gives "Invalid operator for this field" and names the allowed ones.
FieldLabelType
event.actionActionenum
observer.nameSource deviceenum
captivo.guestGuesttext *
captivo.event.familyEvent typeenum: traffic, dhcp, auth, dns
event.timeTimetime
network.transportProtocolenum: tcp, udp, icmp
source.ipSource IPip *
source.portSource portnumber
destination.ipDestination IPip
destination.portDestination portnumber
source.macSource MACmac *
user.nameUsertext *
host.nameHost nametext *
dns.question.nameQueried domaintext *
observer.ingress.interface.nameIngress interfacetext
observer.egress.interface.nameEgress interfacetext
source.nat.ipNAT IPip *
source.nat.portNAT portnumber

* sensitive field: personal data, masked in results and audited when searched.

Parsed and raw mode, limits, results

  • A query that uses fields searches parsed events. A query of free text only, or of source device and time only, searches the raw lines instead; the result is badged Parsed or Raw. In raw mode only the source device and time fields can be used.
  • Results are newest first, 100 per page, at most 100 pages. The total counts only up to 10,000 ("10,000+ results"); narrow the window or the query to go past that. A query that must scan unindexed fields or use contains or regular-expression operators shows a slow-query warning, and any query is stopped after 20 seconds.
  • Parsed rows show time, event type, log source, action, protocol, the connection (source IP:port to destination IP:port), device MAC and guest, and a Who was this? link to identity resolution. Source IP, MAC and guest are masked unless Open Data Display is on; an Admin reveals them one field at a time and each reveal is logged.
  • Above the table, a histogram of events over time (hourly up to 48 hours, then daily) and four top-5 tiles (source IP, destination port, source MAC and one you can swap, action by default). Clicking a visible value narrows the query to it. Charts exist in parsed mode only.

Export, saved queries and what is audited

  • Export CSV / Excel / PDF downloads the current query, up to 50,000 rows (the file says if it was cut) with your organisation's name and logo. The file is masked unless Open Data Display is on or you are an Admin; when clear guest identities leave in a file, one Personal data viewed row goes to the activity log (see KVKK and privacy).
  • Saved queries sit under the window picker. Save as stores the query, its window (one of the five) and its mode under a name of up to 120 characters, unique in the organisation, with an optional description. Everyone with access sees all of them as chips; Manage offers Edit, Overwrite and Delete, allowed to the creator and to Admins. A saved query is checked again each time the page opens and gets an invalid badge with the reason if a field no longer exists.
  • A query that touches a sensitive field (guest, source IP, MAC, user, host name, queried domain, NAT IP) with any operator is written to the activity log as Sensitive Field Log Search with the query, window and fields; the same query by the same person is recorded once per ten minutes. Saving, editing and deleting saved queries are logged too.

The Auto-refresh control above Sources, Raw Logs and Search (Off, 10, 30 or 60 seconds) re-reads the page and pauses while the tab is hidden.

IP and device pages, and Log Reports

Clicking an IP address (for example from a session list) opens its page; a device (MAC) opens the device page. Both take a window of up to seven days (24 hours by default) and show the RADIUS sessions that held it (up to 50), the traffic (the newest 50 events, with a note when there are more and a pointer to Log Search), the DHCP leases (up to 50, with lease event, leased IP and duration), a histogram and a breakdown you can switch. The device page adds the device's known name from DHCP and a table of traffic on addresses the device held: the match goes through the DHCP lease intervals, because the pfSense firewall log carries no MAC. Masking and reveal follow the same rules as search.

Log Reports summarises a date range (last seven days by default): total events, sources, source and destination IPs, the action breakdown, the top 20 source and destination IPs, events per day and per source. It counts traffic events only; DHCP, authentication and DNS events never appear, and the IPs are shown unmasked. Export CSV there writes only the per-source table (label, event count, last event), not the other sections. There is no limit on the range.

The guest column is filled by matching a traffic line's address to the RADIUS session that held it. For that the device must send Framed-IP-Address in its accounting records; without it traffic and guests cannot be linked. Accounting itself is covered in RADIUS settings.

Daily signing and KamuSM

Every night at 00:30, local time, the previous day's raw logs are hashed (SHA-256) and chained to the previous signed day, so removing or editing a day breaks every day after it. The chain head is then sealed with the method chosen under Log Settings → Signing Method:

  • Self-signed (ed25519), the default: proves the logs have not changed since, with a key kept on your server.
  • KamuSM qualified timestamp (RFC 3161): a third-party timestamp from TÜBİTAK BİLGEM Kamu SM. You need a KamuSM timestamp account (customer number and password) and credit; each signed day uses one stamp.

To switch to KamuSM, choose it, pick the Environment (Test, tzd.kamusm.gov.tr, first; then Production, zd.kamusm.gov.tr), enter Customer No and Customer Password, and press Test / check credit: seeing the remaining credit means the connection and the credentials are right. Save. Everything is done in the panel; there is no file to copy and no restart. The password is stored encrypted and never shown again.

  • A change of method applies from the next signed day on; days already signed keep their own method.
  • If the KamuSM settings cannot be loaded, that night's run signs with the self-signed key instead, and only the server's own log notes it. Check the Method column of the archive after switching.
  • If the stamp request itself fails, for example because the credit ran out, the day stays unsigned and is retried on the next nights; each run covers the last three days. Top up and check with Test, and look at the signed archive: a day missing there was not signed.

Archive and verification

Log Server → Archive (5651 Signed Archive) lists the latest 90 signed days with their method and signing time, and lets you download one day or a date range of up to 366 days as a ZIP. For each day the ZIP holds the raw log (5651-YYYY-MM-DD.log), the signature data (.sig.json), for KamuSM days the timestamp token (.zd) and a verification note, DOGRULAMA.txt, written in Turkish. That package is what you hand over when an authority asks for a day's records. Each download is written to the activity log. Days older than the latest 90 are reached through the range download.

Log Server → Verify (Signature Verification) recomputes a chosen day from the stored raw logs and compares it with the signature; pick a day from the last 90. VALID means nothing changed. TAMPERED names what differs: the raw digest, the chain or the signature, and shows both digests. Two caveats. For a KamuSM day the page confirms only the chain and the stored token and still says VALID; the timestamp itself must be checked outside Captivo, for example with KamuSM's tss-client against the .zd file, so this page alone is not proof of the timestamp. And a day with no signature, no token or no public key is also labelled TAMPERED although it is a missing signature, not evidence of tampering; read the reason line. Verification is not written to the activity log.

Retention, disk and ports

These are on Log Server → Settings (Log Settings).

  • Raw log retention (days): 730 days (two years) by default and a hard minimum, up to 3650. A value below 730 is refused with a generic "Save failed", although the box itself accepts smaller numbers. Older raw logs are deleted automatically each night.
  • Search index retention (days): how far back search, the IP and device pages and reports reach, at least 30 days and never longer than the raw retention (otherwise "The search index cannot be kept longer than the raw logs"). It takes the most disk; shortening it does not touch the legal record.
  • Log Storage on the same page shows the space used now, the daily growth (average of up to seven full days), the projected size when the retention window is full, and the free disk. Its verdict is OK, tight (the margin left after the projection is under 20% of the disk) or insufficient (the projection exceeds the free space; it says roughly in how many days the disk fills). If the disk fills, log writing and the database stop, so act on a tight or insufficient verdict. Retention is by time, never by size.
  • The Ingest (Syslog) section only displays the UDP and TCP ports, 514 and 514; they are read-only here. They are set in the server's compose file, not in the panel.

Saving retention or the signing method, assigning a parser and enabling or disabling a source are not written to the activity log; deleting a source, saved queries, SIEM settings and archive downloads are.

SIEM forwarding

Log Server → SIEM sends Captivo's own audit log (who changed what in the panel) to Splunk, QRadar, Sentinel, Wazuh or any syslog receiver. It does not forward the firewall traffic or the 5651 logs. Set the host, port (514 by default), UDP or TCP (TCP has no TLS), CEF or RFC 5424 format and a minimum severity (All, Notice and above, Warnings only), then use Send test; the test reports success even when the receiver is unreachable, so confirm on the SIEM side. Include metadata adds old and new values, which can contain sensitive details; turn it on only if your SIEM needs them. The setting is one per server.

Was this article helpful?