Log Management
Objective :
we need to manage the log of the server and control it from the dashboard and apply some cases as well.
to do that we use the ETW log listener logic inside the Bootstrapper (BallisticServerAgent) solution where the BS will control it and it’s parameters and control running it and the location of the files.
the idea is using the MemoryRingBuffer design pattern where the logs will store in the memory until reach such count or until error happened then the logs will be written inside the log file in the VM that has the BS and in the location that the BS specify.
the dashboard with the API helping will control this process as the case need.
From the servers dashboard, we want the ability to manage server logs.
- Show the number of log files and their total size and other data.
- Clear ballistic logs. This will delete all the ballistic server logs from the server (except the currently active log file, since it will probably be locked).
- Acquire logs. The bootstrapper will upload the logs to a blob and share its URL. The URL link should remain visible on the dashboard (in any session) until a new acquire operation is started.
API of LogManagemnet
- POST /api/LogManagement
By this API the log files metadata are stored in the table “NodeLogMetadata“.the caller (BS) will send a list of “FileMetadata” to this API. - GET /api/LogManagement
By calling http://api.wartothecore.com/api/LogManagement?serverId=value the list of metadata of the log files will be received. - PUT /api/LogManagement
if needed to update data of one log file we will send the updated object to this API. - DELETE /api/LogManagement
to delete metadata of a specific file, you should send the file name and server-id the belongs it to this API to do that.
LogManagementCommand
The objective of this part: is the Command that can be applied on the node to control its logs.
where we have :
- “Flush” command is used in: Trigger a memory to buffer flush.
- “Aquire” command is used in Store the log file in the blob.
- “Delete” command is used in: Delete the log file from the blob.
API of LogManagemnet/Commands
- POST /api/LogManagement/Commands
This API used to save one of the above commands in the table to can apply it by the client (BS)later.
the table name is: “LogManagementCommandInfo”
the requester is the website in this case.
- GET /api/LogManagement/Commands
to get the commands that stored by specific server-id.
the requester is the BS in this case and the BS every 60-sec checks if there any new commands or not to execute them. - DELETE /api/LogManagement/Commands
To delete the command that applied already by the node to can not repeat it again.
API of LogManagement files :
POST /api/LogManagement/LogFile
This Api used to store the log file itself in the blob.
GET /api/LogManagement/LogFile
To can read the file directly from the storage that happened only in the dashboard website by admin login
we use this API to return SAS token where this URI is secured enough to point to the file without damage it.
Recent Comments