Lookup table
To do it yourself, classify each distinct user agent once with the real package, then join the results. Logs hold far fewer distinct user agents than requests, so this is fast, and it gives exactly the same answers as request-time classification.user_agent, category, kind, id, name, operator into a table and join on it:
Generated SQL
When a lookup table isn’t practical, generate aCASE expression from the dataset, with one WHEN per pattern:
- every
agents.jsonentry, in file order; - then every
http-clients.jsonentry.
The first three were verified against every example in the dataset.