GithubHelp home page GithubHelp logo

nihiue / loki-enhance-middleware Goto Github PK

View Code? Open in Web Editor NEW
13.0 13.0 3.0 35.6 MB

Add GeoIP & UA-Parser support for Grafana Loki

JavaScript 52.15% Dockerfile 0.57% Shell 0.43% TypeScript 46.84%
geo-ip loki useragent-parser

loki-enhance-middleware's Introduction

๐Ÿ˜ƒ About Me

  • Developer and Geek

  • Keep 3 Cats ๐Ÿฑ๐Ÿ˜ฝ๐Ÿ˜บ

  • Tech Blog

  • Career

    intel โ€‚โ€‚ alibaba โ€‚โ€‚ Heywhale โ€‚โ€‚ Byte-dance

โšก Overview

Github Stats

Top Lang

๐Ÿšฃ Application

Repo: Thori-dal

Repo: open-ip-kvm

Repo: spa-renderer

๐Ÿš€ Library

Repo: little-byte

Repo: nbconvert

๐ŸŽฎ Fun & Hack

Repo: gesture-gamepad

Repo: JumpHelper

Repo: LetMeRaid

Repo: perfect-loop

โ›๏ธ Tools

Repo: loki-enhance-middleware

Repo: pageshot

Repo: libreoffice-portal

Repo: s3-sync

๐Ÿ’ก Demo

Repo: proxy-reactive-demo

Repo: node-perf-demo

loki-enhance-middleware's People

Contributors

dependabot[bot] avatar nihiue avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

loki-enhance-middleware's Issues

Need help with expressions.

Hi, I would love to use this, but I dont know how to setup the expression via json.

Here is an example of my json output (json is written to file per line)
{"ct_id":0,"ct_mark":0,"detected_application":303,"detected_application_name":"126.netify.google","detected_protocol":188,"detected_protocol_name":"QUIC","detection_guessed":1,"dhc_hit":true,"digest":"99b10c8d5fa0dd3fdd17abe1bfab5b82bad037f2","first_seen_at":1674703379228,"first_update_at":1674703379228,"host_server_name":"clients2.google.com","ip_nat":false,"ip_protocol":17,"ip_version":4,"last_seen_at":1674703379269,"local_ip":"10.0.5.143","local_mac":"c8:2a:dd:88:de:e3","local_origin":true,"local_port":40180,"other_ip":"142.250.176.14","other_mac":"20:6d:31:11:10:d2","other_port":443,"other_type":"remote","vlan_id":0,"interface":"br-lan","internal":true,"type":"flow"}

Here is my promtail.yml config

server:
  http_listen_port: 9080
  grpc_listen_port: 0

positions:
  filename: /tmp/positions.yaml

clients:
  - url: http://lokimiddleware:3100/loki/api/v1/push

- job_name: netify-logs
  static_configs:
  - targets:
      - localhost
    labels:
      job: netifylogs
      __path__: /var/log/netify/*log
    pipeline_stages:
      - json:
          expressions:
            detected_protocol_name: detected_protocol_name
            host_server_name: host_server_name
            local_ip: local_ip
            local_mac: local_mac
            local_port: local_port
            other_ip: local_ip
            other_ip: other_ip
            other_mac: other_mac
            other_port: other_port
      - labels:
          host_server_name:
          local_ip:
          local_mac:
          local_port:
          other_ip:
          other_mac:
          other_port:
      - template:
          source: output_msg
          template: 'detected_protocol_name="{{ .detected_protocol_name }}" local_ip="{{ .local_ip }}" local_mac="{{ .local_mac }}"  local_port="{{ .local_port }}"  GeoIP_Source="{{ .other_ip }}" other_mac="{{ .other_mac }}" other_port="{{ .other_port }}"'
      - output:
          source: output_msg

Support Basic auth

I am not entirely sure, but it seems like this middleware will not pass on the basic auth, meaning you cannot use it if you have authentication enabled for pushing logs to loki.

Could it make sense to ensure that if basic auth is in the request, then it will be passed along?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.