|
|
|
@ -90,7 +90,7 @@ func (ss *Sqlite) GetLogAggregate(la LogAggregateInput) (LogAggregate, error) {
|
|
|
|
|
logs, err := ss.GetLog(GetLogInput{
|
|
|
|
|
Start: la.Start,
|
|
|
|
|
End: la.End,
|
|
|
|
|
Limit: 10000,
|
|
|
|
|
Limit: -1,
|
|
|
|
|
Page: 0,
|
|
|
|
|
})
|
|
|
|
|
if err != nil {
|
|
|
|
@ -362,7 +362,7 @@ func (ss *Sqlite) GetRules() ([]RuleRow, error) {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func (ss *Sqlite) GetLog(in GetLogInput) (GetLogResult, error) {
|
|
|
|
|
if in.Limit <= 0 {
|
|
|
|
|
if in.Limit == 0 {
|
|
|
|
|
in.Limit = 25
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -387,7 +387,12 @@ func (ss *Sqlite) GetLog(in GetLogInput) (GetLogResult, error) {
|
|
|
|
|
glr.TotalResults = lpi.Total
|
|
|
|
|
glr.PageCount = lpi.PageCount + 1
|
|
|
|
|
|
|
|
|
|
sql := `
|
|
|
|
|
limitTxt := "LIMIT ?"
|
|
|
|
|
if in.Limit <= -1 {
|
|
|
|
|
limitTxt = ""
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
sql := fmt.Sprintf(`
|
|
|
|
|
SELECT
|
|
|
|
|
started, clientIp, protocol, domain, totalTimeMs,
|
|
|
|
|
error, recurseRoundTripTimeMs, recurseUpstreamIp, status
|
|
|
|
@ -403,10 +408,10 @@ func (ss *Sqlite) GetLog(in GetLogInput) (GetLogResult, error) {
|
|
|
|
|
recurseUpstreamIp,
|
|
|
|
|
status
|
|
|
|
|
FROM log
|
|
|
|
|
WHERE CAST(strftime('%s', started) AS INTEGER) BETWEEN ? AND ?
|
|
|
|
|
WHERE CAST(strftime('%%s', started) AS INTEGER) BETWEEN ? AND ?
|
|
|
|
|
ORDER BY started DESC
|
|
|
|
|
) WHERE id <= ? ORDER BY id DESC LIMIT ?;
|
|
|
|
|
`
|
|
|
|
|
) WHERE id <= ? ORDER BY id DESC %s;
|
|
|
|
|
`, limitTxt)
|
|
|
|
|
|
|
|
|
|
rows, err := ss.DB.Query(sql, in.Start.UTC().Format(ISO8601), in.End.UTC().Format(ISO8601), lpi.FirstItemID, in.Limit)
|
|
|
|
|
if err != nil {
|
|
|
|
|