question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

ELK playbook example error in nginx.conf

See original GitHub issue

Try and errors

Tried same ‘ELK Playbook’ example in the ‘ELK Logging with Ansible’ of the chapter 8 with some supplements.

supplements and run

  1. Make the provisioning/requirements.yml file.
    ---
    - src: geerlingguy.java
    - src: geerlingguy.nginx
    - src: geerlingguy.elasticsearch
    - src: geerlingguy.elasticsearch-curator
    - src: geerlingguy.kibana
    - src: geerlingguy.logstash
    - src: geerlingguy.logstash-forwarder
    
  2. ansible-galaxy install -r requirements.yml
  3. Place the Vagrantfile in the provisioning folder.
  4. Modify two lines in the Vagranfile.
    ansible.playbook = "elk/playbook.yml"      # origin: "provisioning/elk/playbook.yml"
    ansible.inventory_path = "elk/inventory"   # origin: "provisioning/elk/inventory"
    
  5. vagrant up

errors

TASK [geerlingguy.nginx : Ensure nginx is started and enabled to start at boot.] ***
fatal: [logs]: FAILED! => {"changed": false, "msg": "nginx: [emerg] invalid number of arguments in \"access_log\" directive in /etc/nginx/nginx.conf:27\nnginx: configuration file /etc/nginx/nginx.conf test failed\n"}

I’ve jumped with vagrant ssh and checked /etc/nginx/nginx.conf below. But I can’t find any weird points.

user  www-data;

error_log  /var/log/nginx/error.log warn;
pid        /run/nginx.pid;

worker_processes  2;


events {
    worker_connections  1024;
    multi_accept off;
}

http {

    include       /etc/nginx/mime.types;
    default_type  application/octet-stream;

    server_names_hash_bucket_size 64;

    client_max_body_size 64m;

    log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
                       '$status $body_bytes_sent "$http_referer" '
                       '"$http_user_agent" "$http_x_forwarded_for"';

    access_log  /var/log/nginx/access.log main buffer=16k flush=2m;

    sendfile        on;
    tcp_nopush      on;
    tcp_nodelay     on;

    keepalive_timeout  65;
    keepalive_requests 100;

    server_tokens on;

    # gzip on;



    include /etc/nginx/conf.d/*.conf;
    include /etc/nginx/sites-enabled/*;

    }

Environments and dependencies

OS: Elementary OS Loki (based on Ubuntu 16.04)

ansible 2.5.4
  config file = /etc/ansible/ansible.cfg
  configured module search path = [u'/home/<username>/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/lib/python2.7/dist-packages/ansible
  executable location = /usr/bin/ansible
  python version = 2.7.12 (default, Dec  4 2017, 14:50:18) [GCC 5.4.0 20160609]

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:1
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
geerlingguycommented, Jun 20, 2018

Thanks for the report; I’ll try to get to updating the ELK example soon. It’s one of the few that I haven’t had the time to update in a while (and a LOT has changed in the ELK ecosystem in the past year or so…)

0reactions
geerlingguycommented, Jan 12, 2020

Closing this issue in favor of https://github.com/geerlingguy/ansible-for-devops/issues/196, as I will be reworking the example in its entirety.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Sending Nginx logs to ELK
In this article we will setup Nginx to send it's access and error logs using the syslog standard to Logstash , that stores...
Read more >
Ansible: Setting up web servers with Nginx, configure ...
So, the first part is to setup SSH between our laptop and AWS. Then, we setup local machine for Ansible: install Ansible, writing...
Read more >
Install the ELK stack on CentOS using Ansible - Code Maven
Install the ELK stack on CentOS using Ansible ; Create server, configure inventory · examples/ansible/elk/inventory.yml · 68.183 ; Verify that we ...
Read more >
Log Monitoring with ELK Stack. - Shubham Singh - Medium
While I was setting up kibana, I was facing this error log in nginx logs. 2020/04/13 13:43:08 [crit] 49662#49662: *152 crypt_r() failed (22:...
Read more >
Merge "Add ELK stack and ELK client Ansible playbooks."
elk_server variable will be generated after the ELK stack playbook runs ... { role: nginx } ... name: Generate filebeat configuration template. template:....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found