summaryrefslogtreecommitdiff
path: root/doc/openwrt_logger.md
blob: 1179c8b603ca455dbb35ef8e882c760b7532c60c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# openwrt_logger.py

This script is supposed to be run by cron every 5 minutes or so.
It looks for new lines in log file and sends them to remote server.

OpenWRT must have remote logging enabled (UDP; IP of host this script is launched on; port 514)

`/etc/rsyslog.conf` contains following (assuming `192.168.1.1` is the router IP):

```
$ModLoad imudp  
$UDPServerRun 514  
:fromhost-ip, isequal, "192.168.1.1" /var/log/openwrt.log  
& ~
```

Also comment out the following line:
```
$ActionFileDefaultTemplate RSYSLOG_TraditionalFileFormat
```

Cron line example:
```
* * * * *  /home/user/homekit/src/openwrt_logger.py --access-point 1 --file /var/wrtlogfs/openwrt-5.log  >/dev/null
```

`/var/wrtlogfs` is recommended to be tmpfs, to avoid writes on mmc card, in case
you use arm sbcs as I do.