Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Live-tail implementation #9636

Open
smilu97 opened this issue Jan 16, 2023 · 0 comments
Open

Live-tail implementation #9636

smilu97 opened this issue Jan 16, 2023 · 0 comments
Assignees

Comments

@smilu97
Copy link
Contributor

smilu97 commented Jan 16, 2023

Live Tail

The purpose of the live-tail feature is to literally pull the logs that have just been generated from a specific file on the target host up to the web in real time. In order for the user to use the live-tail feature, the telegraf agent's execd output plugin must be used to connect to the grpc agent provided by pinpoint, which will send logs only when needed in response to signals from the pinpoint collector. The logs sent from the pinpoint output are delivered to the web via the redis pub/sub channel.

realtime-log drawio-1

FileKey Identifier

Every single log files must have their own unique identifier, which is called FileKey

A FileKey consists of three pieces: HostGroupName, HostName, and FileName. The HostGroupName and FileName must be determined by the user, while the HostName is determined by the pinpoint agent, which is the same as the result of /bin/hostname.

The FileKeys are usually serialized with this format, {{HostGroupName}}:{{HostName}}:{{FileName}} in Pinpoint, and it can be found at the redis with the keys below log:files:*

Redis usages

realtime-log drawio-2

The collector should periodically save the registered FileKeys to the Redis value store so that the web knows which FileKeys are currently available.

Once the web has informed users of the FileKeys available to them, then users can specify which FileKey is associated with the file they want to read, and request corresponding live-tail.

Collectors are always listening to those kind of requests via Redis subscribe, and at least one of the collectors must be able to response to the live-tail request. The response must be sent via Redis publish, and received by web via Redis subscribe also at this time.

Web API Specifications

Getting all HostGroupNames

This API returns all distinct HostGroupNames of FileKeys which is registered to the Pinpoint.

GET /log/hostGroups

Response example

["HostGroupA", "HostGroupB"]

Getting Hosts of a HostGroup

This API returns the FileKeys by the HostGroupName in path variable

GET /log/hostGroups/{{hostGroupName}}/hosts

Response example

[{"name":"HostA","files":["fileA"]}]

Live Tail WebSocket API

This API sends the log in real time through WebSocket connection.

WS /log/liveTail?hostGroupName={{hostGroupName}}&hostName={{hostName}}&fileName={{fileName}}

Response example

{
    "seq": 138,
    "logs": [
        {
            "seq": 229,
            "log": "13:19:31 [Worker-30795] DEBUG i.g.n.WeirdHandler :24650 -- THIS IS GENERATED FAKE LOG"
        }
    ]
}
@smilu97 smilu97 self-assigned this Jan 16, 2023
@smilu97 smilu97 closed this as completed May 30, 2023
@smilu97 smilu97 reopened this Aug 23, 2023
smilu97 added a commit to pinpoint-apm/pinpoint-grpc-idl that referenced this issue Aug 23, 2023
smilu97 added a commit to pinpoint-apm/pinpoint-grpc-idl that referenced this issue Aug 23, 2023
smilu97 added a commit to smilu97/pinpoint that referenced this issue Aug 24, 2023
smilu97 added a commit to smilu97/pinpoint that referenced this issue Aug 24, 2023
smilu97 added a commit that referenced this issue Aug 25, 2023
smilu97 pushed a commit to smilu97/pinpoint that referenced this issue Nov 2, 2023
smilu97 pushed a commit to smilu97/pinpoint that referenced this issue Nov 3, 2023
smilu97 pushed a commit that referenced this issue Nov 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant