Open TomonoriSoejima opened 1 year ago
Summary: The code describes two Elasticsearch Watcher API requests related to monitoring and logging the current public IP address of the executing system.
Watcher Creation (PUT _watcher/watch/ip_check
):
ip_check
.https://api.ipify.org?format=json
, a service that returns the public IP of the requester in a JSON format.always
condition.Actions:
log
) which logs the fetched public IP address. The logging message is "Current public IP is {{ctx.payload.ip}}", where {{ctx.payload.ip}}
will be replaced by the actual IP address fetched from the IP service.Elasticsearch Watcher Documentation Elasticsearch HTTP Input Elasticsearch Watch Conditions Elasticsearch Logging Action
Watch Execution (POST _watcher/watch/ip_check/_execute
):
Purpose: This request immediately executes the ip_check
watch.
Note: Using services like ipify.org
to determine the public IP is common, but always ensure you are adhering to any terms of service or rate limits of the external service.
After checking the IP address, you may no longer need this watcher and it can be deleted like this. DELETE _watcher/watch/ip_check