Consolidating large table
I want to group records that have the same combination of class,
  ip_address, and hostname, and keep the highest timestamp for each day
  from each group.


Not using the column name timestamp (like you shouldn't either). It's a reserved word in SQL and a basic type name in Postgres. Using ts instead.

The query is surprisingly simple with DISTINCT ON:

SELECT DISTINCT ON (class, ip_address, hostname, ts::date) *
FROM   agent_log
WHERE  ts &lt; now() - interval '7 days'
ORDER  BY class, ip_address, hostname, ts::date, ts DESC;


Detailed explanation:
Select first row in each GROUP BY group?