Logcat to Syslog (RFC5242) converter
Go to file
kitzman 6b74b82558 time offset + current timezone 2022-02-06 23:41:17 +02:00
.gitignore Initial commit 2022-02-02 17:28:32 +00:00
LICENSE Initial commit 2022-02-02 17:28:32 +00:00
README.md first commit 2022-02-02 23:24:44 +02:00
logcat2sys.py time offset + current timezone 2022-02-06 23:41:17 +02:00

README.md

Synopsis

logcat2sys is a Logcat to Syslog (RFC5242) converter.

It accepts a stream of logcat-formatted messages, and sends them over TCP or UDP using the RFC5242 format.

Usage

The host and port and mandatory.

Additionally, you can specify the delay between each packet, and the protocol.

In order to make reading/aggregating logs easier, you can specify a log-id, which is then added to the log line, so you can grep it, aggregate it, configure Promtail to parse it, etc.

Example

adb logcat | logcat2sys --proto TCP --log-id second-run my-promtail 1514

Options

usage: logcat2sys.py [-h] [--proto PROTO] [--delay DELAY] [--log-id LOG_ID] [--debug] hostname port

logcat to syslog conversion.

positional arguments:
  hostname         hostname to connect to
  port             hostname's port

optional arguments:
  -h, --help       show this help message and exit
  --proto PROTO    protocol (TCP/UDP, default UDP)
  --delay DELAY    sleep between logs
  --log-id LOG_ID  logcat2sys log id
  --debug          enable debugging