# wait\_for -\> check for no moving logs, and skip string "Consul Health Check"

**URL:** <https://forum.ansible.com/t/wait-for-check-for-no-moving-logs-and-skip-string-consul-health-check/31159>\
**Category:** Ansible Developer\
**Created:** [August 29, 2019, 7:15am UTC](https://forum.ansible.com/t/wait-for-check-for-no-moving-logs-and-skip-string-consul-health-check/31159 "2019-08-29T07:15:43Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Denny\_Fuchs](https://avatars.discourse-cdn.com/v4/letter/d/b782af/32.png) [@Denny\_Fuchs](https://forum.ansible.com/u/Denny_Fuchs)\
**Post date:** [August 29, 2019, 7:15am UTC](https://forum.ansible.com/t/wait-for-check-for-no-moving-logs-and-skip-string-consul-health-check/31159/1 "2019-08-29T07:15:43Z")

</div>

hi,

at the moment we use something like:

`

```auto
      - name: wait for possible traffic
        shell: "tail -n 5 /var/log/nginx/ssl-*access*log"
        register: watch_nginx_log
        retries: 30
        delay: 5
        until: "watch_nginx_log.stdout_lines | reject('search','nginx_status') | list | count == 0"
        when: zero_weight is defined

```

`

The goal is to search, if there is _any_ string in the Nginx log file, but drop/skip the nginx\_status, which comes from a Consul health check. So, if there is any other string, “wait\_for” should “wait” and counting, until there is no other lines and then do the next part. An example logfile with no other strings looks like:

`

172.16.1.4 - - [29/Aug/2019:08:43:22 +0200] “GET /nginx\_status HTTP/1.1” 200 111 “-” “Consul Health Check”  
172.16.1.4 - - [29/Aug/2019:08:43:42 +0200] “GET /nginx\_status HTTP/1.1” 200 111 “-” “Consul Health Check”  
172.16.1.4 - - [29/Aug/2019:08:44:02 +0200] “GET /nginx\_status HTTP/1.1” 200 111 “-” “Consul Health Check”  
172.16.1.4 - - [29/Aug/2019:08:44:22 +0200] “GET /nginx\_status HTTP/1.1” 200 111 “-” “Consul Health Check”  
172.16.1.4 - - [29/Aug/2019:08:44:42 +0200] “GET /nginx\_status HTTP/1.1” 200 111 “-” “Consul Health Check”  
172.16.1.4 - - [29/Aug/2019:08:45:02 +0200] “GET /nginx\_status HTTP/1.1” 200 111 “-” “Consul Health Check”

`

I want to replace it with a more Ansible way. I found, that there is a “wait\_for” with search\_regex. Is it possible ? I have to do the same with a squid access.log 🙂

cu denny
