<?xml version="1.0" encoding="utf-8"?>
<feed xml:lang="en" xmlns="http://www.w3.org/2005/Atom"><title>Recent changes to 1: add a time field</title><link href="https://sourceforge.net/p/packet2sql/feature-requests/1/" rel="alternate"/><link href="https://sourceforge.net/p/packet2sql/feature-requests/1/feed.atom" rel="self"/><id>https://sourceforge.net/p/packet2sql/feature-requests/1/</id><updated>2001-09-26T13:33:52Z</updated><subtitle>Recent changes to 1: add a time field</subtitle><entry><title>add a time field</title><link href="https://sourceforge.net/p/packet2sql/feature-requests/1/" rel="alternate"/><published>2001-09-26T13:33:52Z</published><updated>2001-09-26T13:33:52Z</updated><author><name>Steve Schupp</name><uri>https://sourceforge.net/u/schuppy/</uri></author><id>https://sourceforge.netf45875fd378378d20bcc40bc1651ee959fce9f45</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;I made a change to packet2sql i thought you might be interested in.  I added a field, called &lt;br /&gt;
packet_time, so i can store the date and time seperately.  This means that you can do sql queries &lt;br /&gt;
which group by the date; to get a one week summary you could:&lt;br /&gt;
select count(*) as count, packet_date, interface, chain, sourcehost,destport&lt;br /&gt;
from logged_packets&lt;br /&gt;
where interface = &amp;amp;quot;ppp0&amp;amp;quot;&lt;br /&gt;
and chain = &amp;amp;quot;input&amp;amp;quot;&lt;br /&gt;
and packet_date = &amp;amp;quot;2001-09-26&amp;amp;quot;&lt;br /&gt;
group by sourcehost&lt;br /&gt;
order by packet_date DESC LIMIT 7;&lt;/p&gt;
&lt;p&gt;The diffs are:&lt;br /&gt;
# diff packet2sql-2.1.0/src/PacketSieve.cpp PacketSieve.cpp&lt;br /&gt;
177,178c177,178&lt;br /&gt;
&amp;amp;lt;             &amp;amp;lt;&amp;amp;lt; (nday&amp;amp;lt;10?&amp;amp;quot;0&amp;amp;quot;:&amp;amp;quot;&amp;amp;quot;) &amp;amp;lt;&amp;amp;lt; nday &amp;amp;lt;&amp;amp;lt; &amp;amp;quot;',&amp;amp;quot; &amp;amp;lt;&amp;amp;lt; endl&lt;br /&gt;
&amp;amp;lt;         &amp;amp;lt;&amp;amp;lt; setw(8) &amp;amp;lt;&amp;amp;lt; &amp;amp;quot;'&amp;amp;quot; &amp;amp;lt;&amp;amp;lt; stime &amp;amp;lt;&amp;amp;lt; &amp;amp;quot;',&amp;amp;quot; &amp;amp;lt;&amp;amp;lt; endl&lt;br /&gt;
---&lt;br /&gt;
&amp;amp;gt;             &amp;amp;lt;&amp;amp;lt; (nday&amp;amp;lt;10?&amp;amp;quot;0&amp;amp;quot;:&amp;amp;quot;&amp;amp;quot;) &amp;amp;lt;&amp;amp;lt; nday &amp;amp;lt;&amp;amp;lt; &amp;amp;quot; &amp;amp;quot;&lt;br /&gt;
&amp;amp;gt;             &amp;amp;lt;&amp;amp;lt; stime &amp;amp;lt;&amp;amp;lt; &amp;amp;quot;',&amp;amp;quot; &amp;amp;lt;&amp;amp;lt; endl&lt;br /&gt;
# diff packet2sql-2.1.0/sql/logged_packets-ddl.sql logged_packets-ddl.sql&lt;br /&gt;
8,9c8&lt;br /&gt;
&amp;amp;lt;     packet_date date not null,&lt;br /&gt;
&amp;amp;lt;     packet_time time not null,&lt;br /&gt;
---&lt;br /&gt;
&amp;amp;gt;     packet_date timestamp,&lt;br /&gt;
24c23&lt;br /&gt;
&amp;amp;lt;         PRIMARY KEY (packet_date, packet_time, id, sourcehost, desthost));&lt;br /&gt;
---&lt;br /&gt;
&amp;amp;gt;         PRIMARY KEY (packet_date, id, sourcehost, desthost));&lt;/p&gt;
&lt;p&gt;Im not sure if it was possible to do this with the database in the previous form, but i found it easier &lt;br /&gt;
this way - and it made for some interesting queries, so i thought i would share :)&lt;/p&gt;&lt;/div&gt;</summary></entry></feed>