Code Monkey home page Code Monkey logo

Comments (8)

benisai avatar benisai commented on September 12, 2024

The container logs for promtail show this error:

Unable to parse config: /etc/promtail/promtail-config.yaml: yaml: unmarshal errors:
field pipeline_stages not found in type struct { Targets []string "yaml:"targets""; Labels model.LabelSet "yaml:"labels"" }

from loki-enhance-middleware.

Nihiue avatar Nihiue commented on September 12, 2024

To use this middleware, just include GeoIP_Source=XX in output template, and your template is fine.

The real issue is that the indent level of pipeline_stages field is wrong, so promtail could not parse it.

Please look into
https://grafana.com/docs/loki/latest/clients/promtail/pipelines/
https://spacelift.io/blog/yaml

from loki-enhance-middleware.

benisai avatar benisai commented on September 12, 2024

Thanks for the info. I think I've formatted my yaml correct so I can see stuff importing into loki. I see GeoIP_source, but It doesnt seem to be working.

server:
  http_listen_port: 9080
  grpc_listen_port: 0

positions:
  filename: /tmp/positions.yaml

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


scrape_configs:
  - job_name: netify
    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: 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

Middleware is giving this error, which I guess makes sense as it's not a public ip

error: target reject {"name":"server"}

Here is what gets imported into loki:

2023-02-02 21:31:00 | detected_protocol_name:"MDNS" local_ip:"10.0.5.170" local_mac:"78:64:c0:34:7a:ee" local_port:"5353" GeoIP_Source:"224.0.0.251" other_mac:"01:00:5e:00:00:fb" other_port:"5353"

from loki-enhance-middleware.

benisai avatar benisai commented on September 12, 2024

ok, so I can see the public IP in loki and I see the GeoIP, but its not replacing with the location/city. Can you send me a snippet of your log file?

image

from loki-enhance-middleware.

Nihiue avatar Nihiue commented on September 12, 2024

Try to use = instead of : in the template

from loki-enhance-middleware.

benisai avatar benisai commented on September 12, 2024

it works!!!! I needed the = instead of : in my template.

from loki-enhance-middleware.

benisai avatar benisai commented on September 12, 2024

Do you have a grafana dashboard that I can use as an example?

from loki-enhance-middleware.

benisai avatar benisai commented on September 12, 2024

Does the data fields need to match naming conventions that geomap is looking for? I can't make worldmap or geomap work :)

From Grafana:
The Geomap panel needs a source of geographical data. This data comes from a database query, and there are four mapping options for your data.

Auto automatically searches for location data. Use this option when your query is based on one of the following names for data fields.
geohash: “geohash”
latitude: “latitude”, “lat”
longitude: “longitude”, “lng”, “lon”
lookup: “lookup”

from loki-enhance-middleware.

Related Issues (2)

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.