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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
sources:
  journald:
    type: journald
    # The console sink logs to journald, which would loop back in here.
    exclude_units:
      - vector.service
  bird_db_txt:
    type: file
    include:
      - "/home/alpha/BirdNET-Pi/BirdDB.txt"

transforms:
  bird_db:
    type: remap
    inputs:
      - bird_db_txt
    source: |
      keys = split("Date;Time;Sci_Name;Com_Name;Confidence;Lat;Lon;Cutoff;Week;Sens;Overlap", ";")
      parsed = object_from_array(
        split!(.message, ";"),
        keys: keys,
      )

      # handle headers
      if parsed.Date == "Date" {
        abort
      }

      date = string!(parsed.Date)
      time = string!(parsed.Time)
      ts = "{{date}}T{{time}}"
      .timestamp = parse_timestamp!(
          ts,
          format: "%Y-%m-%dT%H:%M:%S",
          timezone: "America/Los_Angeles",
      )

      .com_name = parsed.Com_Name
      .sci_name = parsed.Sci_Name
      .confidence = parsed.Confidence

sinks:
  console:
    type: console
    inputs:
      - bird_db
      - bird_db_txt
    encoding:
      codec: json
  vlogs:
    inputs:
      - journald
    type: http
    uri: http://lotus-land-story:9428/insert/jsonline?_stream_fields=host,_SYSTEMD_UNIT&_msg_field=message&_time_field=timestamp
    compression: gzip
    encoding:
      codec: json
    framing:
      method: newline_delimited
    healthcheck:
      enabled: false