mirror of
https://github.com/moghtech/komodo.git
synced 2026-04-29 12:43:26 -05:00
add container log search via | grep
This commit is contained in:
@@ -23,6 +23,11 @@ pub async fn container_log(container_name: &str, tail: u64) -> Log {
|
||||
run_monitor_command("get container log", command).await
|
||||
}
|
||||
|
||||
pub async fn container_log_search(container_name: &str, search: &str) -> Log {
|
||||
let command = format!("docker logs {container_name} | grep {search}");
|
||||
run_monitor_command("get container log grep", command).await
|
||||
}
|
||||
|
||||
pub async fn container_stats(
|
||||
container_name: Option<String>,
|
||||
) -> anyhow::Result<Vec<DockerContainerStats>> {
|
||||
|
||||
@@ -47,6 +47,22 @@ impl Resolve<GetContainerLog> for State {
|
||||
|
||||
//
|
||||
|
||||
#[derive(Serialize, Deserialize, Debug, Clone, Request)]
|
||||
#[response(Log)]
|
||||
pub struct GetContainerLogSearch {
|
||||
pub name: String,
|
||||
pub search: String,
|
||||
}
|
||||
|
||||
#[async_trait::async_trait]
|
||||
impl Resolve<GetContainerLogSearch> for State {
|
||||
async fn resolve(&self, req: GetContainerLogSearch, _: ()) -> anyhow::Result<Log> {
|
||||
Ok(docker::container_log_search(&req.name, &req.search).await)
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
|
||||
#[derive(Serialize, Deserialize, Debug, Clone, Request)]
|
||||
#[response(DockerContainerStats)]
|
||||
pub struct GetContainerStats {
|
||||
|
||||
Reference in New Issue
Block a user