Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 6 Apr 2017 14:05:41 -0700
From:      Karl Young <karly@kipshouse.org>
To:        Ernie Luzar <luzar722@gmail.com>
Cc:        Steve O'Hara-Smith <steve@sohara.org>, freebsd-questions@freebsd.org
Subject:   Re: Is there a database built into the base system
Message-ID:  <20170406210540.GO2787@mailboy.kipshouse.net>
In-Reply-To: <58E6AFC0.2080404@gmail.com>
References:  <58E696BD.6050503@gmail.com> <69607026-F68C-4D9D-A826-3EFE9ECE12AB@mac.com> <58E69E59.6020108@gmail.com> <20170406210516.c63644064eb99f7b60dbd8f4@sohara.org> <58E6AFC0.2080404@gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
Ernie Luzar(luzar722@gmail.com)@2017.04.06 17:14:40 -0400:
> Steve O'Hara-Smith wrote:
> >On Thu, 06 Apr 2017 16:00:25 -0400
> >Ernie Luzar <luzar722@gmail.com> wrote:
> >
> >>Chuck Swiger wrote:
> >>>On Apr 6, 2017, at 12:27 PM, Ernie Luzar <luzar722@gmail.com> wrote:
> >>>>Looking for a simple database thats comes with the base system, is
> >>>>there one?
> >>>There's likely an old flavor of BerkeleyDB around if you just need a
> >>>key-value store.
> >>>
> >>>If you're looking for a SQL database, start with SQLite (cf
> >>>databases/sqlite3 port), and then look towards MySQL or Postgres.
> >>>
> >>>Regards,
> >>BerkeleyDB sounds like something to look at. Did a "locate
> >>Berkeley" cmd and nothing popped out. Is it called something
> >>else?
> >
> >	man db
> >
> >	Will get you all the details.
> >
> >>Writing csh scripts manipulating text files containing lists of
> >>IP address. Don't want any port as a required dependent. I
> >>though I
> >
> >	Hmm Berkeley DB is a C API so perhaps not so convenient in csh,
> >what do you want a database to do for you ?
> >
> 
> Here is the project description. analyze the unsolicited traffic
> hitting my front door to determine if the same source ip address is
> cycling through a range of ip address on a hourly, daily, weekly
> basis. My test box ipfilter firewall uses "keep state" on everything
> that is allowed out. Nothing is allowed in. Using ipfilter ippool
> in-core ip address table to capture count of times said unsolicited
> inbound source ip address hits my front door. Have 3 flat text files
> containing about 2000 ip address having a record size of 30 bytes.
> I am afraid I may be approaching the max file size that csh can handle.
> Thinking of simple db where the 3 files are indexed and can be
> read/written with out sequentially process all the records. At the
> proof of concept stage.
> 
> I have programmed in pear script before where I can open a file and
> process a record sequentially where only the next record is
> buffered. csh does not have that kind of file handling that I know
> of.
> 
> You have any suggestions?

I'd suggest, Python, Perl, TCL, Ruby, ... anything but csh (or bash) for
a job like this.

I know Python has BDB support:

https://docs.python.org/2/library/bsddb.html

I'm sure all the other languages you might want to use will have support
for BDB, or sqlite.

Although reading and writing a 60K csv file probably isn't that big a
deal, unless you're doing it quite often.  In Python you could import a
CSV file into a dictionary, which makes lookup very fast.

-karl





Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20170406210540.GO2787>