tempesta-tech / tempesta

All-in-one solution for high performance web content delivery and advanced protection against DDoS and web attacks
https://tempesta-tech.com/
GNU General Public License v2.0
623 stars 103 forks source link

tests: tests for access log transmission to Clickhouse server #2269

Open ai-tmpst opened 4 weeks ago

ai-tmpst commented 4 weeks ago

To verify the correct operation of the access log transmission from the Tempesta FW ring buffer, mapped to userspace, to a Clickhouse server via a user-space utility utils/tfw_logger. This test will ensure that access logs are correctly generated by Tempesta FW, and transmitted to the Clickhouse server without data loss or corruption.

Clickhouse has SQL-like query syntax.

Access log table creation: CREATE TABLE IF NOT EXISTS access_log (timestamp DateTime64, address IPv6, method UInt8, version UInt8, status UInt16, response_content_length UInt32, response_time UInt32, vhost String, uri String, referer String, user_agent String, dropped_events UInt64, PRIMARY KEY(timestamp))

For tests I used Clickhouse client/server downloaded as curl https://clickhouse.com/ | sh. But I think it would be better to install the server from distro repositories.

krizhanovsky commented 4 weeks ago

I'll deploy the Clockhouse logs on our website, so there will be manual testing and we can move the task to 0.9.

Things to test:

ai-tmpst commented 1 week ago

for i in $(seq 1 30); do kill -SIGSTOP 8384 && sleep 10 && kill -SIGCONT 8384; done Something like this we need in tests. Now it can lead to incorrect tail position.