Search
 
SCRIPT & CODE EXAMPLE
 

SHELL

parse json logs in loki, promtail

{"level":"info","time":"2021-08-16T18:26:46.621Z","name":"bme280.data","msg":"data","temperature":26.03,"pressure":999.39,"humidity":45.32,"altitude":116}

I used following promtail config:

    scrape_configs:
    - job_name: kubernetes-pods-name
      pipeline_stages:
        - json:
            expressions:
              altitude: altitude
              humidity: humidity
              level: level
              output: msg
              pressure: pressure
              temperature: temperature
              timestamp: time
        - labels:
            level: null
        - timestamp:
            format: RFC3339
            source: timestamp
        - output:
            source: output
      kubernetes_sd_configs:
      - role: pod
      
#I was hoping that simply by defining the JSON parsing and labels I get to see these labels in the Grafana Explore. I do see the log entries in Grafana as shown below, but I don’t see any labels that are part of the JSON keys.
Comment

PREVIOUS NEXT
Code Example
Shell :: can we store the name of the current branch in a variable in bash 
Shell :: dgram i node 
Shell :: tarball -list 
Shell :: brew install keepnote 
Shell :: nextjs cli node options 
Shell :: Length of $FOO 
Shell :: git config --global user.email "you@example.com" 
Shell :: query of meta command psql 
Shell :: openssl rand -hex 32 windows 
Shell :: scapy tutorials for mac 
Shell :: Command to install parse-url module 
Shell :: pip install pi 
Shell :: github repository 
Shell :: bash print one line until match 
Shell :: add geckodriver to path linux 
Shell :: touch command not recognized in windows 
Shell :: github commands 
Shell :: delete all folders except one linux 
Shell :: unzip .tar.xz 
Shell :: how to push to a new branch in gitlab 
Shell :: how to uninstall photos app in windows 10 
Shell :: add one drive to ubuntu 
Shell :: error installing cocoapods mac 
Shell :: psneuter download 
Shell :: how to install wtforms on mac terminal 
Shell :: FATAL module ucvideo not found 
Php :: laravel artisan clear cache 
Php :: laravel order by random 
Php :: get start of month end of month carbon 
Php :: php get current domain 
ADD CONTENT
Topic
Content
Source link
Name
7+4 =