mirror of
https://github.com/cupcakearmy/ora.git
synced 2024-12-22 08:06:28 +00:00
support for specifiyng host
This commit is contained in:
parent
88ebc6b5dd
commit
45d09a41ce
@ -5,14 +5,17 @@ import { Logs } from '../shared/db'
|
|||||||
|
|
||||||
export async function data({ start, end }) {
|
export async function data({ start, end }) {
|
||||||
const logs = await getLogsBetweenDates({ start, end })
|
const logs = await getLogsBetweenDates({ start, end })
|
||||||
console.log('Found', logs.length)
|
|
||||||
return groupBy(logs, 'host')
|
return groupBy(logs, 'host')
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function getLogsBetweenDates({ start, end }) {
|
export async function getLogsBetweenDates({ start, end, host }) {
|
||||||
return await Logs.find({
|
const where = {
|
||||||
$and: [{ timestamp: { $gt: start } }, { timestamp: { $lt: end } }],
|
$and: [{ timestamp: { $gt: start } }, { timestamp: { $lt: end } }],
|
||||||
})
|
}
|
||||||
|
console.log(host)
|
||||||
|
if (host) where.host = host
|
||||||
|
console.log('Where', where)
|
||||||
|
return await Logs.find(where)
|
||||||
}
|
}
|
||||||
|
|
||||||
export function countInGroup(grouped) {
|
export function countInGroup(grouped) {
|
||||||
|
Loading…
Reference in New Issue
Block a user