News for hackers. Stuff that matters.
Re:PgOSQuery: Expose the operating system as a Postgres data... by JonnieCache on Thursday October 30, 2014 @10:23AM (#8533077)
Re:PgOSQuery: Expose the operating system as a Postgres data... by Shish2k on Thursday October 30, 2014 @10:55AM (#8533259)
Indeed it is; TBH, having seen how easy this was to make, I wonder if there would be any merit to making a stripped-down postgres package which is just daemon + SQL parser + FDW interface (so no built-in storage engine) -- the FDW interface is amazing for building SQL interfaces for arbitrary data sets, but the whole postgres bundle seems a little heavy-weight and complex to install if that's the only thing you want it for...

Or I guess you could start from the other direction, and make a FDW/Multicorn-compatible API for SQLite? (Facebook's OSQuery is SQLite-based, but it looks like the virtual table interface over there is way more complex)

Re:PgOSQuery: Expose the operating system as a Postgres data... by johnteslade on Thursday October 30, 2014 @01:17PM (#8534322)
I tried this with sqlite and the apsw python library. A quick example is at https://github.com/johnteslade/pysqliteosquery

The interface is not quite as nice as Multicorn's but certainly nicer than the C/C++ SQLlite interface. But you could probably create a wrapper around apsw so it looked similar to Multicorn.

Re:PgOSQuery: Expose the operating system as a Postgres data... by Erwin on Thursday October 30, 2014 @03:37PM (#8535310)
FYI, you can use ":memory:" as the sqlite data source, instead of having to conditionally drop the tables (unless you actually do want to store some persistent data on disk).
Re:PgOSQuery: Expose the operating system as a Postgres data... by johnteslade on Friday October 31, 2014 @05:32AM (#8537964)
Good spot. The in memory table also runs 3 times quicker.
Re:PgOSQuery: Expose the operating system as a Postgres data... by crxgames on Thursday October 30, 2014 @11:04AM (#8533325)
That would remove some of my hesitancy in letting this run as root for full process information. At least it limits what code could be exploited in the daemon process to some extent.
Re:PgOSQuery: Expose the operating system as a Postgres data... by mamcx on Thursday October 30, 2014 @11:04AM (#8533323)
And the opposite? Have the sqlite storage but no the sql parser?
Re:PgOSQuery: Expose the operating system as a Postgres data... by rakoo on Thursday October 30, 2014 @12:22PM (#8533901)
What would be the use case ? Data already exists on the OS, no need to copy it on another storage and risk having stale values.
Re:PgOSQuery: Expose the operating system as a Postgres data... by batbomb on Thursday October 30, 2014 @01:28PM (#8534386)
Don't forget about Presto
Re:PgOSQuery: Expose the operating system as a Postgres data... by orf on Thursday October 30, 2014 @06:13PM (#8536137)
Yeah, heres a link to the awesome psutil library it uses: https://github.com/giampaolo/psutil

It could be made a bit more efficient by filtering the processes[1], but the code would not look nearly as lovely.

1. http://multicorn.org/implementing-an-fdw/#idoptimizations

Re:PgOSQuery: Expose the operating system as a Postgres data... by hippowithgas on Thursday October 30, 2014 @05:23PM (#8535909)
I can see we are going to get one of these DB / OS Adapters each day now. Looking forward to BerkDBOSQuery - because, well, the Berkeley DB needs some love too.