java - Should I use a key/value database to store my API logs? -
i lot of logs api. analyse logs interesting information how many users api in month or type of activities do.
all of analysis depend on period. so timestamp important me.
in fact, use indexes on timestamp. problem timestamp continue.
my question database more appropriate use case?
i heard key/value databases, interesting use timestamp key?
thanks.
this two-year-old article ibm talks more sql implementation, possibly keep in mind when nosql implementation:
- "why current timestamp produces poor primary keys" - https://www.ibm.com/developerworks/community/blogs/sqltips4db2luw/entry/current_timestamp?lang=en
of course, app different, i'm not sure of granularity of time-stamping, possible have 2 items logfiled @ same timestamp.
you might better off creating other form of unique key algorithm key-value store, adding sort of serialization per timestamp. first item @ timestamp ".1", second ".2", etc. you'd have sort of timestamp.serialid format.
the other thought have is: merging api log files multiple applications/processes or machines? might able sort of elementid.appid.timestamp.serialid make unique key.
it depends on use case, can't more sure. wonder want key-value store in terms of reads/analysis after-the-fact, might highly alter nosql solution. if planning lot of log analysis, then, yes, there's reason put nosql database, if want fast analysis of data, , push of older items disk storage.
as databases, each vendor stick product; choose best tool job. best try before buy, , test things out specific setup. i'm aerospike, i'm biased towards key-value store: http://www.aerospike.com/
talked smart guy today, , suggested might want use "milliseconds since date-time 'x'" primary key. depending on logging, there might still chance of collision primary key.
therefore, suggestion take entries primary key (ex: log entries millisecond) , load them same record, in kind of "bucket." you'd need application logic parse out multiple log entries under same primary key, that's way skin cat.
Comments
Post a Comment