Skip to content

Container Actions

You can configure actions for your containers. Supported actions are restart, stop and start and are configured per container.

You can perform these actions on the monitored container itself or on other containers.

The action_cooldown is per action and defaults to 300 seconds (5 minutes) and has to be at least 10 seconds.

INFO

Note that actions require access to the docker socket and generally don't work with a Docker Socket Proxy.

Perform actions on the monitored container

yaml
containers:
  action_cooldown: 60  # 1 minute cooldown
  container3:
    - regex: "process.*(failed|did not finish)" 
      action: restart  # Restart the container when this regex is found
    - keyword: critical
      action: stop     # Stop the container when this keyword is found
      action_cooldown: 10  # 10 seconds cooldown for this action

Perform actions on other containers

yaml
containers:
  container3:
    - regex: "process.*(failed|did not finish)" 
      action: restart@some-other-container  # Restart another container when this regex is found
    - keyword: critical
      action: stop@some-other-container     # Stop anoter container when this keyword is found
    - keyword: timeout
      action: start@some-other-container

Trigger OliveTin Actions

OliveTin is a great tool that allows you to perform predefined commands from a web interface. Fortunately for us it also has a API that we can use to trigger actions when LoggiFly finds certain keywords in the logs.

You can configure your OliveTin URL globally in the settings section or per container and even per keyword/regex in case you want to trigger commands on different OliveTin instances.

If you have configured a Local User Login you can use the username and password to trigger actions that require authentication.

Then you can configure the olivetin_action_id per keyword or regex.

The execution output of the action is sent in a separate notification.

Here is a an example config snippet:

yaml
containers:
  container3:
    - regex: 'download.*failed'
      olivetin_action_id: some-action-id

settings:
  olivetin_url: http://192.168.178.20:1337
  olivetin_username: admin
  olivetin_password: password