Skip to content

Commit

Permalink
missing docker events (agent #157)
Browse files Browse the repository at this point in the history
  • Loading branch information
aleks-f committed Oct 19, 2016
1 parent 90150b4 commit 6f52840
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions userspace/libsinsp/docker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,34 @@ void docker::handle_event(Json::Value&& root)
{
is_allowed = m_event_filter->has(type, status);
}
// status for exec_* events is different, eg.:
// "container:exec_create: ls -l"
if(!is_allowed)
{
std::string exec_create = "exec_create";
std::string exec_start = "exec_start";
std::string::size_type pos = status.find(exec_create);
if(pos != std::string::npos)
{
status = exec_create;
g_logger.log("Docker EVENT: found exec_create status=" + status, sinsp_logger::SEV_TRACE);
}
else
{
pos = status.find(exec_start);
if(pos != std::string::npos)
{
status = exec_start;
g_logger.log("Docker EVENT: found exec_start status=" + status, sinsp_logger::SEV_TRACE);
}
}
if(pos != std::string::npos)
{
is_allowed = m_event_filter->has(type, status);
g_logger.log("Docker EVENT: status=" + status + (is_allowed ? " is " : " is not ") + "allowed",
sinsp_logger::SEV_TRACE);
}
}
}
else // older docker versions don't tell type, so there will be some overlap of duplicates
{
Expand Down

0 comments on commit 6f52840

Please sign in to comment.