Skip to content

Commit 9e52aab

Browse files
committed
Setting up mezmo to log server.log.
1 parent d121152 commit 9e52aab

File tree

6 files changed

+96
-23
lines changed

6 files changed

+96
-23
lines changed

ansible/provision.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
- { role: provision, tags: base }
88
- { role: nginx, tags: nginx, when: "'kindle' in inventory_hostname" }
99
- { role: certbot, tags: certbot, when: "'kindle' in inventory_hostname" }
10-
# - { role: logspout, tags: logspout }
1110
- { role: mezmo, tags: mezmo }
1211
- { role: android_x86, tags: android-x86 }
1312
# - { role: android_arm, tags: android-arm }

ansible/roles/logspout/tasks/main.yml

Lines changed: 0 additions & 16 deletions
This file was deleted.

ansible/roles/logspout/vars/main.yml

Lines changed: 0 additions & 4 deletions
This file was deleted.
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
---
2+
- name: restart logdna-agent
3+
systemd:
4+
name: logdna-agent
5+
state: restarted
6+
daemon_reload: yes
7+
8+
- name: restart logdna container
9+
docker_container:
10+
name: logdna
11+
restart: yes

ansible/roles/mezmo/tasks/main.yml

Lines changed: 59 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,61 @@
11
---
2+
# Add Mezmo repository and GPG key using the exact commands from documentation
3+
- name: Add Mezmo repository and GPG key
4+
become: yes
5+
block:
6+
- name: Add Mezmo repository
7+
shell: echo "deb https://assets.logdna.com stable main" | tee /etc/apt/sources.list.d/logdna.list
8+
args:
9+
creates: /etc/apt/sources.list.d/logdna.list
10+
11+
- name: Download Mezmo GPG key
12+
get_url:
13+
url: https://assets.logdna.com/logdna.gpg
14+
dest: /tmp/logdna.gpg
15+
mode: "0644"
16+
17+
- name: Add Mezmo GPG key
18+
apt_key:
19+
file: /tmp/logdna.gpg
20+
state: present
21+
id: C1BF174AEF506BE8
22+
register: apt_key_result
23+
ignore_errors: yes
24+
25+
- name: Add Mezmo GPG key (alternative method)
26+
shell: apt-key adv --keyserver keyserver.ubuntu.com --recv-keys C1BF174AEF506BE8
27+
args:
28+
warn: false
29+
when: apt_key_result is failed
30+
31+
- name: Update apt cache
32+
apt:
33+
update_cache: yes
34+
35+
# Install Mezmo agent
36+
- name: Install Mezmo agent
37+
apt:
38+
name: logdna-agent
39+
state: present
40+
update_cache: yes
41+
42+
# Create Mezmo agent configuration
43+
- name: Create Mezmo agent configuration
44+
template:
45+
src: mezmo-agent.conf.j2
46+
dest: /etc/logdna.env
47+
mode: "0644"
48+
notify: restart logdna-agent
49+
50+
# Enable and start Mezmo agent service
51+
- name: Enable and start Mezmo agent service
52+
systemd:
53+
name: logdna-agent
54+
enabled: yes
55+
state: started
56+
daemon_reload: yes
57+
58+
# Keep the existing logspout container for Docker logs
259
- name: Start mezmo logspout docker container
360
docker_container:
461
name: logdna
@@ -9,8 +66,8 @@
966
- /var/run/docker.sock:/var/run/docker.sock
1067
env:
1168
LOGDNA_KEY: "{{ MEZMO_LOGDNA_KEY }}"
12-
FILTER_NAME: ""
13-
TAGS: "{{ inventory_hostname }}"
69+
FILTER_NAME: "{{ mezmo_filter_name }}"
70+
TAGS: "{{ inventory_hostname }}{% if mezmo_tags %},{{ mezmo_tags }}{% endif %}"
1471
HOSTNAME: "{{ inventory_hostname }}"
1572
networks:
1673
- name: sol-network
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# Environment variables for logdna-agent
2+
LOGDNA_LOG_DIRS=/opt/kindle-automator/logs
3+
LOGDNA_EXCLUSION_RULES=/var/log/*
4+
MZ_SYSTEMD_JOURNAL_TAILER=false
5+
LOGDNA_INGESTION_KEY={{ MEZMO_LOGDNA_KEY }}
6+
LOGDNA_TAGS={{ inventory_hostname }}{% if mezmo_tags %},{{ mezmo_tags }}{% endif %}
7+
LOGDNA_EXCLUDE=/var/log/wtmp,/var/log/btmp
8+
LOGDNA_EXCLUDE_REGEX=.*\.gz$,.*\.zip$
9+
10+
# Disable systemd journal collection
11+
LOGDNA_JOURNALD=false
12+
# Connection settings
13+
LOGDNA_SSL=true
14+
LOGDNA_COMPRESSION=true
15+
LOGDNA_LOG_LEVEL=debug
16+
17+
# Improve real-time log detection
18+
LOGDNA_DBPERSIST=true
19+
LOGDNA_RESCANINTERVAL=10
20+
LOGDNA_LOGSENDBATCHSIZE=5
21+
LOGDNA_LOGSENDBATCHTIME=3000
22+
23+
# Connectivity settings
24+
LOGDNA_RECONNECTTIMEOUT=120
25+
LOGDNA_RETRYCOUNT=5
26+
LOGDNA_RETRYTIMEOUT=60

0 commit comments

Comments
 (0)