This page describes how to setup Grafana Promtail and Loki for sending the contents of local logs to the centralized Grafana Loki server or Grafana Cloud.
- Docker Engine
- Docker Compose
| // ============================================================================ | |
| // TYPES & INTERFACES | |
| // ============================================================================ | |
| type Gender = "masculine" | "feminine" | "neutral"; | |
| interface NumberWords { | |
| ones: string[]; | |
| tens: string[]; | |
| } |
| #!/bin/bash | |
| # --- Defaults --- | |
| JOB_NAME="" | |
| NODE_ENV="" | |
| LOKI_URL="http://localhost:3100" | |
| LOG_LEVEL="debug" | |
| COMMAND_ARGS=() | |
| BUFFER_SIZE=100 | |
| FLUSH_INTERVAL=5 |
| #!/usr/bin/env python3 | |
| import gi | |
| gi.require_version("Gtk", "3.0") | |
| gi.require_version("AppIndicator3", "0.1") | |
| from gi.repository import Gtk, GLib, AppIndicator3 | |
| import subprocess | |
| import requests | |
| import os | |
| import signal |
| const debounce = <T extends (...args: any[]) => any>( | |
| fn: T, | |
| delay: number | |
| ): ((...args: Parameters<T>) => void) => { | |
| let timeoutId: NodeJS.Timeout; | |
| return (...args) => { | |
| clearTimeout(timeoutId); | |
| timeoutId = setTimeout(() => fn(...args), delay); | |
| }; |
| { | |
| "workbench.editor.customLabels.patterns": { | |
| "**/src/routes/+page.svelte": "Root Page", | |
| "**/src/routes/+layout.svelte": "Root Layout", | |
| "**/src/routes/+page.ts": "Root Page Data (Universal)", | |
| "**/src/routes/+page.server.ts": "Root Page Data (Server)", | |
| "**/src/routes/+layout.server.ts": "Root Layout Data (Server)", | |
| "**/src/routes/+layout.ts": "Root Layout Data (Universal)", | |
| "**/src/routes/*/**/+page.svelte": "${dirname} - Page", | |
| "**/src/routes/*/**/+layout.svelte": "${dirname} - Layout", |
| version: '3.0' | |
| services: | |
| duplicati: | |
| image: 'lscr.io/linuxserver/duplicati:latest' | |
| environment: | |
| - SERVICE_FQDN_DUPLICATI # Assign a FQDN so I can access it remotely | |
| - PUID=0 # Important - sets it to access the host file system as root | |
| - PGID=0 # Important - sets it to access the host file system as root | |
| - TZ=Europe/London # Change this to your server's timezone | |
| - CLI_ARGS= |
| #!/usr/bin/python | |
| from urllib.request import Request, urlopen | |
| import json | |
| class Discord: | |
| def __init__(self, webhook: str, botname: str = "April O'Neil", | |
| avatarurl: str = "https://i.pinimg.com/originals/87/67/11/876711e56a0ef942cbb2f15844235f2e.jpg"): | |
| self.webhook = webhook |
| import requests | |
| from bs4 import BeautifulSoup | |
| def download_file(download_url, filename): | |
| r = requests.get(download_url) | |
| with open(f"MagPi-{filename}.pdf", "wb") as code: | |
| print(f"Downloading => {filename} issue") | |
| code.write(r.content) |
| token = "#" # MYBOT TOKEN | |
| channel = "#" # MY ID | |
| import requests | |
| def sendtochannelphoto(_token, _channel, image_path, image_caption=""): | |
| data = {"chat_id": _channel, "caption": image_caption} | |
| url = f"https://api.telegram.org/bot{_token}/sendPhoto?" \ | |
| f"chat_id={_channel}" |