Skip to content

victoriaLog:The statistical data time period returned by the http api /select/logsql/hits in victoriaLog is not continuous. #700

@zoutao0909

Description

@zoutao0909

Is your question request related to a specific component?

The statistical data time period returned by the http api /select/logsql/hits in victoriaLog is not continuous.

Describe the question in detail

Request: curl http://10.10.210.157:32228/select/logsql/hits -d 'query=* AND _stream:{logType="sys-audit",hostname="qob132"}' -d 'start=2024- 05-23T21:06:52.867245Z' -d 'end=2024-05-24T09:06:52.867245Z' -d 'step=1h'
expected outcome:

{"hits":[{"fields":{},"timestamps":["2024-05-23T21:00:00Z","2024-05-23T22:00:00Z","2024-05-23T23: 00:00Z","2024-05-24T00:00:00Z","2024-05-24T01:00:00Z","2024-05-24T02:00:00Z","2024-05-24T03:00: 00Z","2024-05-24T04:00:00Z","2024-05-24T05:00:00Z","2024-05-24T06:00:00Z","2024-05-24T07:00:00Z" ,"2024-05-24T08:00:00Z","2024-05-24T09:00:00Z"],"values":[20,4,0,0,15,53,0,6,0,14 ,0,29,32]}]}

actual results:

{"hits":[{"fields":{},"timestamps":["2024-05-23T21:00:00Z","2024-05-23T22:00:00Z","2024-05-24T01: 00:00Z","2024-05-24T02:00:00Z","2024-05-24T04:00:00Z","2024-05-24T06:00:00Z","2024-05-24T08:00: 00Z","2024-05-24T09:00:00Z"],"values":[20,4,15,53,6,14,29,32]}]}

I want to get the number of logs in each time period per hour within a specified time range, but when the logs in a certain time period are 0, this time period will not be included in the entire returned result.
I would like to ask what kind of scenario this interface is designed for. The current scenario I want to use is in the scenario of log analysis, which is used to assemble the histogram data of . The data in the current area is not continuous. If so, it will increase the processing cost of the caller. However, it would be better if the returned data can be adjusted to the key:value time:count format. Such a format can more clearly represent the number of logs corresponding to each time period.

Troubleshooting docs

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions