question stringlengths 11 28.2k | answer stringlengths 26 27.7k | tag stringclasses 130
values | question_id int64 935 78.4M | score int64 10 5.49k |
|---|---|---|---|---|
Using logstash 2.3.4-1 on centos 7 with kafka-input plugin I sometimes get
{:timestamp=>"2016-09-07T13:41:46.437000+0000", :message=>#0, :events_consumed=>822, :worker_count=>1, :inflight_count=>0, :worker_states=>[{:status=>"dead", :alive=>false, :index=>0, :inflight_count=>0}], :output_info=>[{:type=>"http", :confi... | According to this github issue your ruby code could be causing the issue. Basically any ruby exception will cause the filter worker to die. Without seeing your ruby code, it's impossible to debug further, but you could try wrapping your ruby code in an exception handler and logging the exception somewhere (at least u... | Logstash | 39,532,116 | 12 |
I am new to ELK stack and playing around with it in a development environment. That's why I end up deleting an index (DELETE /index_name) and recreating multiple times. Deleting an index that I created works fine, but I notice that there are few lingering system indices, like .monitoring-es-2-2017.02.05.
What is the... | These indices are created by the Elastic X-Pack monitoring component. X-Pack components are elasticsearch plugins and thus store their data, like Kibana, in elasticsearch. Unlike the .kibana index these indices are created daily because they contain timeseries monitoring data about elasticsearch's performance. Deleting... | Logstash | 42,121,684 | 12 |
I am currently using filebeat to forward logs to logstash and then to elasticsearch.
Now, I am thinking about forwarding logs by rsyslog to logstash. The benefit of this would be that, I would not need to install and configure filebeat on every server, and also I can forward logs in JSON format which is easy to parse a... | When you couple Beats with Logstash you have something called "back pressure management" - Beats will stop flooding the Logstash server with messages in case something goes wrong on the network, for instance.
Another advantage of using Beats is that in Logstash you can have persisted queues, which prevents you from l... | Logstash | 44,387,910 | 12 |
I try to install logstash with a docker-compose but docker exited with code 0 just after Installation successful when I try to install a logstash plugin.
The part of docker-compose file for logstash is:
logstash:
image: docker.elastic.co/logstash/logstash-oss:7.0.1
ports: ['9600:9600']
command: bin/logsta... | I use a Dockerfile to fix it.
My Dockerfile:
FROM docker.elastic.co/logstash/logstash-oss:7.0.1
RUN rm -f /usr/share/logstash/pipeline/logstash.conf && \
bin/logstash-plugin install logstash-filter-metricize
My part of docker-compose:
logstash:
build:
context: ./logstash
ports: ['9600:9600']
vo... | Logstash | 56,041,596 | 12 |
Edit : I changed the title because the issue was not what I initially thought. The fact is that logstash takes more than a minute to starts, which can be misinterpreted as "silence"...
I'm trying to make logstash running, so I've followed the instruction on the official site for a standalone installation : http://logs... | Ok, I've found by myself.
Everything was working just fine. It's just that logstash is soooooo long to launch. More than 60 seconds on my (humble) server !!
Add to that huge starting time the fact that nothing is printed when launched...
| Logstash | 13,270,004 | 11 |
I am using logstash-1.4.1, elasticsearch-1.1.1 and kibana-3.1.0 for analyzing my logs. I am able to view and query my logs.
There's a need in which an alert/notification is needed when a particular log/event happens. Eg: When a Login failed log occurs again and again, an alert/notification (popup, via mail, etc) is req... | You can use Watcher for monitoring your Elasticsearch. It alerts you via mail.
For further details, refer to this link:
https://www.elastic.co/products/watcher
You can follow these steps to configure Watcher:
Step 1 – Install Plugin for Watcher (for 1.7):
bin/plugin --install elasticsearch/watcher/latest
bin/plugin --... | Logstash | 23,948,695 | 11 |
I have setup logstash to use an embedded elastisearch.
I can log events.
My logstash conf looks thus:
https://gist.github.com/khebbie/42d72d212cf3727a03a0
Now I would like to add another udp input and have that input be indexed in another index.
Is that somehow possible?
I would do it to make reporting easier, so I co... | Use an if conditional in your output section, based on e.g. the message type or whatever message field is significant to the choice of index.
input {
udp {
...
type => "foo"
}
file {
...
type => "bar"
}
}
output {
if [type] == "foo" {
elasticsearch {
...
index => "foo-index"
... | Logstash | 27,146,032 | 11 |
So I wrote now several patterns for logs which are working. The thing is now, that I have these multiple logs, with multiple patterns, in one single file. How does logstash know what kind of pattern it has to use for which line in the log? ( I am using grok for my filtering ) And if you guys would be super kind, could ... | You could use multiple patterns for your grok filter,
grok {
match => ["fieldname", "pattern1", "pattern2", ..., "patternN"]
}
and they will be applied in order but a) it's not the best option performance-wise and b) you probably want to treat different types of logs differently anyway, so I suggest you use conditio... | Logstash | 28,450,501 | 11 |
I have ELK installed and working in my machine, but now I want to do a more complex filtering and field adding depending on event messages.
Specifically, I want to set "id_error" and "descripcio" depending on the message pattern.
I have been trying a lot of code combinations in "logstash.conf" file, but I am not able t... | I have solved the problem. I get the expected results with the following code in "logstash.conf":
input {
file {
path => "C:\xxx.log"
}
}
filter {
grok {
patterns_dir => "C:\elk\patterns"
match => [ "message", "%{ERROR1:error1}" ]
match => [ "message", "%{ERROR2:error2}" ]
}
if [message] =~ ... | Logstash | 29,826,619 | 11 |
I downloaded Logstash-1.5.0 on Windows 8.1 and tried to run it in the command prompt.
First I checked the java version.
Then changed the directory to logstash-1.5.0/bin
then entered the command logstash -e 'input { stdin { } } output { elasticsearch { host => localhost } stdout { } }' it gave the following error:
Cann... | Set the JAVA_HOME and PATH environmental variables like this:
JAVA_HOME = C:\Program Files\Java\jdk1.7.0_25
PATH = C:\Program Files\Java\jdk1.7.0_25\bin
| Logstash | 30,427,355 | 11 |
I'm running into some issues sending log data to my logstash instance from a simple java application. For my use case, I'm trying to avoid using log4j logback and instead batch json events on separate lines through a raw tcp socket. The reason for that is I'm looking to send data through a aws lambda function to logsta... | The problem is that your data is already deserialized on your input and you are trying to deserialize it again on your filter. Simply remove the json filter.
Here is how I recreated your scenario:
# the json input
root@monitoring:~# cat tmp.json
{"message":{"someField":"someValue"}}
# the logstash configuration fil... | Logstash | 35,143,576 | 11 |
I'm using only kibana to search ElasticSearch and i have several fields that can only take a few values (worst case, servername, 30 different values).
I do understand what analyze do to bigger, more complex fields like this, but the small and simple ones i fail to understand the advance/disadvantage of anaylyzed/not_an... | I will to try to keep it simple, if you need more clarification just let me know and I'll elaborate a better answer.
the "analyzed" field is going to create a token using the analyzer that you had defined for that specific table in your mapping. if you are using the default analyzer (as you refer to something without e... | Logstash | 37,532,648 | 11 |
I'm trying to have logstash output to elasticsearch but I'm not sure how to use the mapping I defined in elasticsearch...
In Kibana, I did this:
Created an index and mapping like this:
PUT /kafkajmx2
{
"mappings": {
"kafka_mbeans": {
"properties": {
"@timestamp": {
"type": "date"
}... | What you need to change is very simple. First use the json codec in your kafka input. No need for the json filter, you can remove it.
kafka {
...kafka details....
codec => "json"
}
Then in your elasticsearch output you're missing the mapping type (parameter document_type below), which i... | Logstash | 42,206,826 | 11 |
We are currently use azure scale set (many VMs on one source group with load balance and one availability set), we used to use NLog to log our web app action and errors, but now we asked/needs to use Elastic Search and also use centralized log for all azure vm instances instead of file per each instance.
I am new to ES... | For NLog there is a target "NLog.Targets.ElasticSearch" (nuget)
which uses the Elasticsearch.Net package.
Usage:
<nlog>
<extensions>
<add assembly="NLog.Targets.ElasticSearch"/>
</extensions>
<targets>
<target name="elastic" xsi:type="BufferingWrapper" flushTimeout="5000">
<target xsi:type="ElasticS... | Logstash | 49,595,422 | 11 |
When I try start logstash server on my machine I get this error:
Sending Logstash's logs to D:/kibana/logstash-6.3.2/logs which is now configured
via log4j2.properties
ERROR: Pipelines YAML file is empty. Location: D:/kibana/logstash-6.3.2/config/p
ipelines.yml
usage:
bin/logstash -f CONFIG_PATH ... | Looks like you're trying to start your Logstash with multiple pipelines configuration:
When you start Logstash without arguments, it will read the
pipelines.yml file and instantiate all pipelines specified in the
file. On the other hand, when you use -e or -f, Logstash ignores the
pipelines.yml file and logs a w... | Logstash | 53,780,598 | 11 |
GrayLog2 requires both ElasticSearch and MongoDB, while Logstash uses only ElasticSearch for persisting and searching the logs. what does mongo provide in graylog2?
| Graylog2 uses mongodb for the web interface entities. Streams, alerts, users, settings, cached stream counts etc. Pretty much everything you see and edit in the web interface except for the logs themselves.
| Logstash | 17,399,567 | 10 |
With the logstash 1.2.1 one can now have conditional to do various stuff. Even the earlier version's conf file can get complicated if one is managing many log files and implement metric extraction.
After looking at this comprehensive example, I really wondered my self, how can I detect any breakages in this configurat... | For a syntax check, there is --configtest:
java -jar logstash.jar agent --configtest --config <yourconfigfile>
To test the logic of the configuration you can write rspec tests. This is an example rspec file to test a haproxy log filter:
require "test_utils"
describe "haproxy logs" do
extend LogStash::RSpec
confi... | Logstash | 18,823,917 | 10 |
I'm using Grok & Logstash to send access logs from Nginx to Elastic search. I'm giving Logstash all my access logs (with a wildcard, works well) and I would like to get the filename (some part of it, to be exact) and use it as a field.
My config is as follows :
input {
file {
path => "/var/log/nginx/*.access.log"... | Ok, found it. grok breaks on match by default. So the first match being good, it skips the second one.
I solved it like that :
filter {
if [type] == "nginx_access" {
grok {
match => { "message" => "%{COMBINEDAPACHELOG}" }
match => { "path" => "%{GREEDYDATA}/%{GREEDYDATA:app}.access.log" }
break... | Logstash | 23,780,000 | 10 |
I am using Logstash to parse postfix logs. I am mainly focused to get bounced email logs from postfix logs, and store it in database.
In order to get logs, first I need to find ID generated by postfix corresponding to my message-id, and using that Id, I need to find status of an email. For following configuation, I am... | You need to protect the 2nd grok block -- ie don't execute it if the first one succeeds.
if ("BOUNCED" not in [tags]) {
grok {
patterns_dir => "patterns"
match => [
"message", "%{SYSLOGBASE} %{POSTFIXCLEANUP}"
]
add_tag => ["INTIALIZATION"]
remove_tag => ["_grokparsefailure"]
... | Logstash | 24,705,450 | 10 |
I want to have a centralized logging server.
I have created two Ubuntu 12.04 LTS servers based on this iso.
After successfully and strictly following this tutorial steps, I have:
One Logging Server with Logstash + ElasticSearch + Kibana.
And one Application Server with a Logstash-Forwarder, Tomcat 6 and another app, w... | Here is what I have, note that the access logs use a custom log format (documented below) and I extract a bit more information out of the Tomcat logs (it is useful to have logLevel as a field, for example):
input {
file {
type => "access-log"
path => [ "C:/apache-tomcat-6.0.18/logs/*.txt" ]
}
... | Logstash | 25,429,377 | 10 |
When i see results in Kibana, i see that there are no fields from JSON, more over, message field contains only "status" : "FAILED".
Is it possible to parse fields from json and to show them in Kibana?
I have following config:
input {
file {
type => "json"
path => "/home/logstash/test.json"
codec => json
... | Yes. you need to add a filter to your config, something like this.
filter{
json{
source => "message"
}
}
It's described pretty well in the docs here
EDIT
The json codec doesn't seem to like having an array passed in. A single element works with this config:
Input:
{"uid":"441d1d1dd296fe60","name":"test... | Logstash | 28,753,921 | 10 |
I'm trying to setup a ELK stack on EC2, Ubuntu 14.04 instance. But everything install, and everything is working just fine, except for one thing.
Logstash is not creating an index on Elasticsearch. Whenever I try to access Kibana, it wants me to choose an index, from Elasticsearch.
Logstash is in the ES node, but the ... | I got identical results on Amazon AMI (Centos/RHEL clone)
In fact exactly as per above… Until I injected some data into Elastic - this creates the first day index - then Kibana starts working. My simple .conf is:
input {
stdin {
type => "syslog"
}
}
output {
stdout {codec => rubydebug }
elasticsearch {... | Logstash | 29,227,392 | 10 |
I'm actually using node-bunyan to manage log information through elasticsearch and logstash and I m facing a problem.
In fact, my log file has some informations, and fills great when I need it.
The problem is that elastic search doesn't find anything on
http://localhost:9200/logstash-*/
I have an empty object and so... | Here is how we managed to fix this and other problems with Logstash not processing files correctly on Windows:
Install the ruby-filewatch patch as explained here:
logstash + elasticsearch : reloads the same data
Properly configure the Logstash input plugin:
input {
file {
path => ["C:/Path/To/Logs/Directory/*... | Logstash | 29,701,796 | 10 |
Let's imagine that I have a Logstash instance running, but would like to stop it cleanly, to change it's configs for example.
How can I stop the Logstash instance, while ensuring that it finish sending the bulks to Elasticsearch? I don't want to loose any logs while stopping logstash.
| Logstash 1.5 flushes the pipeline before shutting down in response to a SIGTERM signal, so there you should be able to shut it down with service logstash stop, the init.d script, or whatever it is that you usually use.
With Logstash 1.4.x a SIGTERM signal shuts down Logstash abruptly without allowing the pipeline to fl... | Logstash | 29,742,313 | 10 |
You know how there is a Ruby filter for Logstash which enables me to write code in Ruby and it is usually included in the config file as follows
filter {
ruby {
code => "...."
}
}
Now I have two Jar files that I would like to include in my filter so that the input I have can be processed accordi... | So to answer this, I found this wonderful tutorial from Elastc.co:
Shows the steps to create a new gem and use it as a filter for Logstash later on.
https://www.elastic.co/guide/en/logstash/current/_how_to_write_a_logstash_filter_plugin.html
| Logstash | 32,370,646 | 10 |
I was checking the nginx error logs at our server and found that they start with date formatted as:
2015/08/30 05:55:20
i.e. YYYY/MM/DD HH:mm:ss. I was trying to find an existing grok date pattern which might help me in parsing this quickly but sadly could not find any such date format. Eventually, I had to write the ... | No. You find the included patterns on github. The comment to datestamp seems to fit to your YYYY/MM/DD, but DATE_US and DATE_EU are different.
I suggest overload the DATE pattern using grok option patterns_dir and go with DATESTAMP.
DATE_YMD %{YEAR}/%{MONTHNUM}/%{MONTHDAY}
DATE %{DATE_US}|%{DATE_EU}|%{DATE_YMD}
or jus... | Logstash | 32,415,944 | 10 |
In my Celery application I am getting 2 types of logs on the console i.e celery application logs and task level logs (inside task I am using logger.INFO(str) syntax for logging)
I wanted to send both of them to a custom handler (in my case python-logstash handler )
For django logs I was successfull, by setting handler ... | def initialize_logstash(logger=None,loglevel=logging.DEBUG, **kwargs):
# logger = logging.getLogger('celery')
handler = logstash.TCPLogstashHandler('localhost', 5959,tags=['worker'])
handler.setLevel(loglevel)
logger.addHandler(handler)
# logger.setLevel(logging.DEBUG)
return logger
from celery... | Logstash | 39,265,344 | 10 |
Is it possible to launch a Ruby debugger from within the Logstash Ruby filter plugin? It would be very handy for debugging.
| The good Logstash folks have thought of this already as they included pry into Logstash core. So all you have to do is to require pry in your ruby filter code as shown in the sample config below:
input {
file {
path => "/tmp/myfile.csv"
sincedb_path => "/dev/null"
start_position => "beginning"
}
}
filt... | Logstash | 40,226,282 | 10 |
I have application where some critical issues are reported with console.error but are not thrown so application might continue to run - possibly in crippled state.
It's necessary to report also console.error issues, but Sentry (Raven) library send to server only thrown exceptions.
Does someone knows how to solve this n... | As user @kumar303 mentioned in his comment to the question ... you can use the JS console integration Sentry.Integrations.CaptureConsole.
See the documentation.
At the end you JS code to setup Sentry looks as follows:
import * as Sentry from '@sentry/browser';
import { CaptureConsole } from '@sentry/integrations';
Sen... | Sentry | 50,633,580 | 64 |
I just installed Sentry for a client-side JavaScript app using the standard code snippet they provided. How do I test that it's working properly? I've tried manually throwing an error from my browser console and it didn't appear in Sentry. Is there any documentation on the right way to do this?
| The browser console can not be used as it is sandboxed. A simple trick is to attach the code to an HTML element like this:
<h1 onClick="throw new Error('Test')">
My Website
</h1>
And click on the heading afterwards.
This can be done in the browser inspector and so your source code doesn't have to be modified.
| Sentry | 47,333,846 | 46 |
Since the recently introduced new structure of the Program.cs startup code, the documentation confuses me a bit.
In the officially provided Serilog.AspNetCore example and in the Serilog.Sentry example, they use .UseSerilog() on the WebHostBuilder. I cannot find this method.
This is what I have tried:
using Serilog;
va... | You'll need to make sure you have the following packages installed:
Serilog
Serilog.Extensions.Hosting (this provides the .UseSerilog extension method. If you have the Serilog.AspNetCore package, you do not need to explicitly include this)
Then you'll need a using:
using Serilog;
Which should allow you to access .Us... | Sentry | 71,599,246 | 33 |
Sometimes I get ReferenceError in my sentry with this instantSearchSDKJSBridgeClearHighlight. Google says nothing.
All I found is https://github.com/algolia/instantsearch-android and https://github.com/algolia/instantsearch-ios that may be related to my issue.
I got 53 issues from 5 different users and all of them Edge... | This is a bug in the Bing Instant Search feature in Edge on iOS; the feature tries to call a function that no longer exists. Thanks for the bug; I've passed it along to the feature owners.
The basic idea is that for Edge on iOS the actual web engine is not our normal one (Blink); it is instead Safari's WkWebView.
In or... | Sentry | 69,261,499 | 30 |
I am using Sentry (in a django project), and I'd like to know how I can get the errors to aggregate properly. I am logging certain user actions as errors, so there is no underlying system exception, and am using the culprit attribute to set a friendly error name. The message is templated, and contains a common message ... | See my final update in the question itself. Events are aggregated on a combination of 'project', 'logger', 'culprit' and 'checksum' properties. The first three of these are relatively easy to control - the fourth, 'checksum' is a function of the type of data sent as part of the event.
Sentry uses the concept of 'interf... | Sentry | 13,331,973 | 26 |
We are running a Django server and using Sentry to capture exceptions. When we configure Sentry we add RAVEN_CONFIG our different settings.py files:
INSTALLED_APPS = (
'raven.contrib.django.raven_compat'
)
RAVEN_CONFIG = {
'dsn': 'https://*****@app.getsentry.com/PORT_NUMBER',
}
We read here that we can just u... |
We read here that we can just use an empty string DSN property.
You should not be setting DSN to an empty string, but instead in your development settings configuration don't specify the DSN setting in the first place:
RAVEN_CONFIG = {}
| Sentry | 35,888,806 | 26 |
I'm using sentry-python SDK for capture exceptions from my django server.
I don't want to capture django.security.DisallowedHost like above.
How to remove sentry handling for that logger?
I attached my server configuration below.
settings.py
LOGGING = {
'version': 1,
'disable_existing_loggers': False,
'han... | Quick answer
See LoggingIntegration, eg:
from sentry_sdk.integrations.logging import ignore_logger
ignore_logger("a.spammy.logger")
logger = logging.getLogger("a.spammy.logger")
logger.error("hi") # no error sent to sentry
A more elaborate but generic way to ignore events by certain characteristics
See before_brea... | Sentry | 52,927,353 | 26 |
There are two ways to set up sourcemaps: having them hosted on the site and referenced in the bundled files or uploading them directly to a service like sentry. I'm trying to accomplish the latter. The problem is that there seems to be no way to generate sourcemaps using angular cli without having the filepath written ... | As mentioned in the comments, you can enable sourceMaps in the angular.json file like this:
"configurations": {
"production": {
"sourceMap": {
"scripts": true,
"styles": true,
"hidden": true
},
Also, I recommend you remove the .map files after uploading to sentry and before deploying. So ... | Sentry | 52,489,770 | 24 |
How to config SMTP Settings in Sentry?
I set my SMTP mail-server configuration on onpremise/config.yml, then I did as follows:
sudo docker-compose run --rm web upgrade
sudo docker-compose up -d (before that, I removed previous consider containers)
But in Sentry mail setting panel not appeared my SMTP configs:
NOT... | Problem solved:
I updated my Sentry version from 8.22.0 to 9.0.0 with Dockerfile and configure config.yml file as following:
A piece of config.yml on onpremise package:
###############
# Mail Server #
###############
mail.backend: 'smtp' # Use dummy if you want to disable email entirely
mail.host: 'smtp.gmail.com'... | Sentry | 50,344,403 | 21 |
Framework / SDK versions:
Flutter: 3.10.4
Dart: 3.0.3
Here goes my main() code:
Future<void> main() async {
//debugPaintSizeEnabled = true;
//BindingBase.debugZoneErrorsAreFatal = true;
WidgetsFlutterBinding.ensureInitialized();
EasyLocalization.ensureInitialized()
.then((value) => Fimber.plantTree(Debug... | You can find the solution at https://github.com/getsentry/sentry-dart/tree/main/flutter#usage.
ensureInitialized has to be called within the runZonedGuarded
import 'dart:async';
import 'package:flutter/widgets.dart';
import 'package:sentry_flutter/sentry_flutter.dart';
Future<void> main() async {
// creates a zone
... | Sentry | 76,472,459 | 18 |
While my DSN is in a .env file and hidden from the repo browsers, I find it disturbing that my auth token is in the sentry.properties file for all to see.
I'm having trouble understanding what this means and how much of a security risk is it to let people outside my organization read this file?
(I have outsourced devel... | We recommend treating a sentry.properties like an .env file.
It is basically the same, so you should add it to your e.g. .gitignore.
The reason why it's called sentry.properties is because of android gradle, we needed it to be read natively.
| Sentry | 48,368,670 | 17 |
Sentry can detect additional data associated with an exception such as:
How do you raise such an exception from Python (it's a Django app) with your own additional data fields?.
| I log exceptions using the logging library so after debugging the code a bit, I noticed the extra parameter:
import logging
logger = logging.getLogger('my_app_name')
def do_something():
try:
#do some stuff here that might break
except Exception, e:
logger.error(e, exc_info=1, extra={'extra-da... | Sentry | 15,951,136 | 16 |
I have a Spring Boot application that uses Sentry for exception tracking and I'm getting some errors that look like this:
ClientAbortExceptionorg.apache.catalina.connector.OutputBuffer in realWriteBytes
errorjava.io.IOException: Broken pipe
My understanding is that it's just a networking error and thus I should genera... | If you look at the class SentryExceptionResolver
public class SentryExceptionResolver implements HandlerExceptionResolver, Ordered {
@Override
public ModelAndView resolveException(HttpServletRequest request,
HttpServletResponse response,
... | Sentry | 48,914,391 | 15 |
I want to setup a Sentry logger for a Django project. I will define a sentry handler and will put that handler in the root logger with error level.
According to the documentation of logging module, there a special root key:
root - this will be the configuration for the root logger. Processing of the configuration will... | Either way will work, because the logger named '' is the root logger. Specifying the top-level key root makes it clearer what you're doing if you're configuring a lot of loggers - the '' logger configuration could be lost inside a group of others, whereas the root key is adjacent to the loggers key and so (in theory) s... | Sentry | 20,258,986 | 13 |
We're are using Sentry for our React App and faced this issue. Don't know where exactly this issue is coming from? This variable '_avast_submit' (or related named variable) is not at all used in either frontend or backend. In the screenshot it's mentioned anonymous.
This issue had occurred for the user's who had used o... | This is due to an Avast extension of browser.
Unfortunately when tracking (all) JS errors, also errors originating from browser extensions could reported to Sentry.
Mentioned in Github comments: https://github.com/getsentry/sentry/issues/9331
| Sentry | 51,720,715 | 13 |
Introduction
Hi, I'm trying to get Sentry to recognise our sourcemaps in a react-native project, but I can't get it working.
The artifacts are uploading - I can see them in the WebUI, but the events lack context/mapping:
Question
Can anyone see any problems in my setup?
Thanks!
Background
Assumptions
uploading rel... | After MONTHS, we realised we had to write client code to knit in the Distribution and Release....
const configureSentry = () => {
Sentry.config(config.sentry.dsn).install();
Sentry.setDist(DeviceInfo.getBuildNumber());
Sentry.setRelease(DeviceInfo.getBundleId() + '-' + DeviceInfo.getVersion(... | Sentry | 56,020,745 | 13 |
I'm currently working with Celery tasks in a Django based project. We have raven configured to send all uncaught exceptions and log messages to Sentry, as described in the documentation.
Everything works pretty good, except for uncaught exceptions inside celery tasks. For example, if I run this task:
@app.task
def test... | As described by DRC in the comment up there, we finally got to the solution using this approach:
https://docs.getsentry.com/hosted/clients/python/integrations/celery/
Basically doing this:
import celery
class Celery(celery.Celery):
def on_configure(self):
if hasattr(settings, 'RAVEN_CONFIG') and settings.... | Sentry | 27,550,916 | 12 |
How to add custom tags to get raven set it to sentry?
When I used raven in django there was several tags like OS, Browser, etc.
But I want to add such tags by myself using raven, without django.
Thanks.
| If I'm correctly understanding the question, you can pass to sentry whatever you want in extra dictionary, see raven docs.
You can also construct messages via capture* methods (and pass extra too):
capture
captureException
captureMessage
captureQuery
Btw, OS, browser...etc parameters sentry gets from the passed reque... | Sentry | 15,326,658 | 11 |
I may be a bit late on the train, but I wanted to use Sentry and Raven for logging in Django.
I set up sentry and raven to the point, where I ran the test for raven and it works.
So now I want to send my debug messages over to sentry, but how would I do this?
settings.py
RAVEN_CONFIG = {
'dsn': 'http://code4@mydoma... | You have 3 loggers defined: django, raven and sentry.errors. When you call logging.getLogger(__name__) you actually create a "throw-away" one, because your ___name__ doesn't match any of above.
You should either use the raven logger...
logger = logging.getLogger('raven')
logger.debug('Hola!')
...or setup your own:
LOG... | Sentry | 34,729,025 | 11 |
The documentation was not very helpful for me.
Locations I've tried:
root folder (where gradle.properties and project's build.gradle files reside)
/app folder (where app's build.gradle file is localed)
/app/src/main/kotlin
I initialize Sentry on start of my app in class that extends android.app.Application like so:
... | There are in fact two different sentry.properties files.
The sentry.properties that is used by the app at runtime to configure the DSN should be placed at /app/src/main/resources (documentation).
The sentry.properties that is used at build time by Gradle to generate and upload ProGuard mappings to Sentry. This should ... | Sentry | 49,485,428 | 11 |
The error in the title is caught by Sentry (an error tracking tool). Below is a screenshot from Sentry - showing the stack trace.
Note: the script /en_US/iab.autofill.payment.js where handleMessage is located is loaded from Facebook (link here), and I couldn't find this script in the javascript bundle, nor anything re... | I'm seeing this a lot, and it seems to be coming 100% from users using Facebook browser on iOS (I guess this is the browser you see when you're using the Facebook app).
I tried to debug this with a snippet:
<script>
window.addEventListener('message', function (e) {
console.log(e);
JSON.parse(e.data)... | Sentry | 64,042,411 | 11 |
I have a simple setup for a project that imitates the Next JS sentry (simple) example
The problem is without sentry Enable JavaScript source fetching feature on, I cannot get the source maps to report correctly to sentry
example:
with the Enable JavaScript source fetching it shows correctly
example (of the same error)... | This can be solved by abandoning the configure-sentry-release.sh script to upload the source maps manually but instead using sentry webpack plugin
yarn add @sentry/webpack-plugin
and use the plugin with next.config.js (webpack) to upload the source maps during the build step
// next.config.js
...
webpack(config, o... | Sentry | 61,011,281 | 10 |
Using Axios interceptors to handle the 400's and 500's in a generic manner by showing an Error Popup. Usually, Sentry calls are triggered when the custom _error.js page is rendered due to a JS error. How do I log the API call errors in sentry?
| You can either use an axios interceptor or write it in the catch() of your axios call itself.
Interceptor
axios.interceptors.response.use(
(response: AxiosResponse) => response,
(error: AxiosError) => {
Sentry.captureException(error);
return Promise.reject(error);
},
);
Axios Call
axios({
url,
... | Sentry | 65,043,634 | 10 |
I have an installation of Symfony 4.3 and I upgrade it to 4.4.19.
On my old installation Sentry was working well with excluded_exception.
I use it like this on sentry.yaml :
sentry:
dsn: "https://key@sentry.io/id"
options:
excluded_exceptions:
- App\Exception\BadArgumentException
... | Please check upgrade file for Sentry Symfony 4.0.
According to this file sentry.options.excluded_exceptions configuration option was removed.
To exclude exceptions you must use IgnoreErrorsIntegration service:
sentry:
options:
integrations:
- 'Sentry\Integration\IgnoreErrorsIntegration'
services:
Sentry\... | Sentry | 66,154,926 | 10 |
As a beginner to Sentry and web dev and debugging issues, some of the errors Sentry is picking up are completely baffling to me, including this one. Our web app seems just fine at the URL that Sentry is saying there is an error at. I'm not familiar with our app using anything related to webkit-masked-url. Is it safe to... | This particular set of mysterious errors has been asked about on Sentry's GitHub, and they reference a WebKit issue.
According to the comments there, they are caused by an error coming from a Safari browser extension, and can safely be ignored, or filtered.
| Sentry | 74,197,049 | 10 |
Sleuth is not sending the trace information to Zipkin, even though Zipkin is running fine.
I am using Spring 1.5.8.RELEASE, spring cloud Dalston.SR4 and I have added the below dependencies in my microservices:
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-sleuth</art... | I found that I need to add a sampler percentage. By default zero percentage of the samples are sent and that is why the sleuth was not sending anything to zipkin. when I added spring.sleuth.sampler.percentage=1.0 in the properties files, it started working.
| Zipkin | 47,670,883 | 10 |
What are the differences between Prometheus and Zabbix?
| Both Zabbix and Prometheus may be used in various monitoring scenarios, and there isn't any particular specialization in either of these. Zabbix is older than Prometheus and probably more stable, with more ready-to-use solutions.
Zabbix has a core written in C and a web UI based on PHP. Also it uses "agents" (client-si... | Zabbix | 35,305,170 | 35 |
I am exploring grafana for my log management and system monitoring.
I found kibana is also used for same process.
I just don't know when to use kibana and when to use grafana and when to use zabbix?
| Zabbix - complex monitoring solution including data gathering, data archiving (trends, compaction,...), visualizer with dashboards, alerting and some management support for alerts escalations. (have a look at collectd, prometheus, cacti. They are all able to gather data)
Grafana - visualizer of data. It can read data a... | Zabbix | 40,882,040 | 16 |
Here is my goal: I would like to be able to report various metrics to zabbix so that we can display the graphs on a web page.
These metrics include:
latency per soap service submission
various query results from one or more databases.
What things do I need to write and/or expose? Or is the zabbix server going to ... | I can offer 2 suggestions to get the metrics into Zabbix:
Use the zabbix_sender binary to feed the data from your script directly to the Zabbix server. This allows your script to call on it's own interval and set all the parameters needed. You really only need to know the location to the zabbix_sender binary. Inside ... | Zabbix | 6,348,053 | 14 |
My Goal:
I would like to extract graphs associated with hosts in .png format. My GOOGLE research say's we don't have Zabbix API designed to do this task. So few blogs advised to user Chart2.php & CURL. Can someone explain me how to go about it ( detailed steps )?
Note: Sorry never worked on php nor on curl
When i tri... | This works with the normal password authentication, you need to adapt it to openid which I don't use and most certainly you will have to change options for this to work with curl.
1. wget --save-cookies=z.coo -4 --keep-session-cookies -O - -S --post-data='name=(a zabbix username)&password=(password)&enter=Enter' 'http:... | Zabbix | 13,653,853 | 12 |
I have a .NET app that must send data to a Zabbix server. How to do that?
| This is sample .Net library to connect Zabbix API https://github.com/p1nger/ODZL
| Zabbix | 2,373,705 | 10 |
I have read the Prometheus documentation carefully, but its still a bit unclear to me, so I am here to get confirmation about my understanding.
(Please note that for the sake of the simplest examples possible I have used the one second for scraping interval, timerange - even if its not possible in practice)
Despite we ... | In an ideal world (where your samples' timestamps are exactly on the second and your rule evaluation happens exactly on the second) rate(counter[1s]) would return exactly your ICH value and rate(counter[5s]) would return the average of that ICH and the previous 4. Except the ICH at second 1 is 0, not 1, because no one ... | Prometheus | 54,494,394 | 212 |
I need to show, in Grafana, a panel with the number of requests in the period of time selected in the upper right corner.
For this I need to solve 2 issues here, I will ask the prometheus question here and the Grafana question in another link.
If I have a Counter http_requests_total, How can I build a query to get an i... | What you need is the increase() function, that will calculate the difference between the counter values at the start and at the end of the specified time interval. It also correctly handles counter resets during that time period (if any).
increase(http_requests_total[24h])
If you have multiple counters http_requests_t... | Prometheus | 47,138,461 | 196 |
I'm developing something that needs Prometheus to persist its data between restarts. Having followed the instructions
$ docker volume create a-new-volume
$ docker run \
--publish 9090:9090 \
--volume a-new-volume:/prometheus-data \
--volume "$(pwd)"/prometheus.yml:/etc/prometheus/prometheus.yml \
prom/... | Use the default data dir, which is /prometheus. To do that, use this line instead of what you have in your command:
...
--volume a-new-volume:/prometheus \
...
Found here: https://github.com/prometheus/prometheus/blob/master/Dockerfile
Surprisingly is not mentioned in the image docs
| Prometheus | 50,009,065 | 79 |
Following the Prometheus webpage one main difference between Prometheus and InfluxDB is the usecase: while Prometheus stores time series only InfluxDB is better geared towards storing individual events. Since there was some major work done on the storage engine of InfluxDB I wonder if this is still true.
I want to set... | InfluxDB CEO and developer here. The next version of InfluxDB (0.9.5) will have our new storage engine. With that engine we'll be able to efficiently store either single event data or regularly sampled series. i.e. Irregular and regular time series.
InfluxDB supports int64, float64, bool, and string data types using di... | Prometheus | 33,350,314 | 77 |
I'm making a Grafana dashboard and want a panel that reports the latest version of our app. The version is reported as a label in the app_version_updated (say) metric like so:
app_version_updated{instance="eu99",version="1.5.0-abcdefg"}
I've tried a number of Prometheus queries to extract the version label as a string... | My answer tries to elaborate on Carl's answer. I assume that the GUI layout may have changed a little since 2016, so it took me while to find the "name" option.
Assuming you have a metric as follows:
# HELP db2_prometheus_adapter_info Information on the state of the DB2-Prometheus-Adapter
# TYPE db2_prometheus_adapter_... | Prometheus | 38,525,891 | 65 |
I have job definition as follows:
- job_name: 'test-name'
static_configs:
- targets: [ '192.168.1.1:9100', '192.168.1.1:9101', '192.168.1.1:9102' ]
labels:
group: 'development'
Is there any way to annotate targets with labels? For instance, I would like to add 'service-1' label to '192.16... | I have the same question before. Here is my solution:
use job_name as the group label
add more target option to separate instance and add labels
For you the code may like this:
- job_name: 'development'
static_configs:
- targets: [ '192.168.1.1:9100' ]
labels:
service: '1'
- targ... | Prometheus | 49,829,423 | 65 |
I want to count number of unique label values. Kind of like
select count (distinct a) from hello_info
For example if my metric 'hello_info' has labels a and b. I want to count number of unique a's. Here the count would be 3 for a = "1", "2", "3".
hello_info(a="1", b="ddd")
hello_info(a="2", b="eee")
hello_info(a="1"... | count(count by (a) (hello_info))
First you want an aggregator with a result per value of a, and then you can count them.
| Prometheus | 51,882,134 | 63 |
I want to calculate the cpu usage of all pods in a kubernetes cluster. I found two metrics in prometheus may be useful:
container_cpu_usage_seconds_total: Cumulative cpu time consumed per cpu in seconds.
process_cpu_seconds_total: Total user and system CPU time spent in seconds.
Cpu Usage of all pods = increment per s... | This I'm using to get CPU usage at cluster level:
sum (rate (container_cpu_usage_seconds_total{id="/"}[1m])) / sum (machine_cpu_cores) * 100
I also track the CPU usage for each pod.
sum (rate (container_cpu_usage_seconds_total{image!=""}[1m])) by (pod_name)
I have a complete kubernetes-prometheus solution on GitHub, ... | Prometheus | 40,327,062 | 61 |
If I have a metric with the following labels:
my_metric{group="group a"} 100
my_metric{group="group b"} 100
my_metric{group="group c"} 100
my_metric{group="misc group a"} 1
my_metric{group="misc group b"} 2
my_metric{group="misc group c"} 1
my_metric{group="misc group d"} 1
Is it possible to do a query or even ... | It's even easier
sum by (group) (my_metric)
| Prometheus | 45,154,993 | 58 |
I have Prometheus server installed on my AWS instance, but the data is being removed automatically after 15 days. I need to have data for a year or months. Is there anything I need to change in my prometheus configuration?
Or do I need any extensions like Thanos? I am new to Prometheus so please be easy on the answers.... |
Edit the prometheus.service file
vi /etc/systemd/system/prometheus.service
add "--storage.tsdb.retention.time=1y" below to "ExecStart=/usr/local/bin/prometheus \" line.
So the config will look like bellow for 1 year of data retention.
[Unit]
Description=Prometheus
Wants=network-online.target
After=network-online.ta... | Prometheus | 59,298,811 | 53 |
I'm monitoring docker containers via Prometheus.io. My problem is that I'm just getting cpu_user_seconds_total or cpu_system_seconds_total.
How to convert this ever-increasing value to a CPU percentage?
Currently I'm querying:
rate(container_cpu_user_seconds_total[30s])
But I don't think that it is quite correct (comp... | Rate returns a per second value, so multiplying by 100 will give a percentage:
rate(container_cpu_user_seconds_total[30s]) * 100
| Prometheus | 34,923,788 | 51 |
I have Prometheus configuration with many jobs where I am scraping metrics over HTTP. But I have one job where I need to scrape the metrics over HTTPS.
When I access:
https://ip-address:port/metrics
I can see the metrics.
The job that I have added in the prometheus.yml configuration is:
- job_name: 'test-jvm-metrics'
... | Probably the default scrape_timeout value is too short for you
[ scrape_timeout: <duration> | default = 10s ]
Set a bigger value for scrape_timeout.
scrape_configs:
- job_name: 'prometheus'
scrape_interval: 5m
scrape_timeout: 1m
Take a look here https://github.com/prometheus/prometheus/issues/1438
| Prometheus | 49,817,558 | 49 |
I need to write a query that use any of the different jobs I define.
{job="traefik" OR job="cadvisor" OR job="prometheus"}
Is it possible to write logical binary operators?
| Prometheus has an or logical binary operator, but what you're asking about here is vector selectors.
You can use a regex for this {job=~"traefik|cadvisor|prometheus"}, however that you want to do this is a smell.
| Prometheus | 43,134,060 | 48 |
I have no clue what the option "instant" means in Grafana when creating graph with Prometheus.
Any ideas?
| It uses the query API endpoint rather than the query_range API endpoint on Prometheus, which is more efficient if you only care about the end of your time range and don't want to pull in data that Grafana is going to throw away again.
| Prometheus | 51,728,031 | 47 |
I'm trying to configure Prometheus and Grafana with my Hyperledger fabric v1.4 network to analyze the peer and chaincode mertics. I've mapped peer container's port 9443 to my host machine's port 9443 after following this documentation. I've also changed the provider entry to prometheus under metrics section in core.yml... | Since the targets are not running inside the prometheus container, they cannot be accessed through localhost. You need to access them through the host private IP or by replacing localhost with docker.for.mac.localhost or host.docker.internal.
On Windows:
host.docker.internal (tested on win10, win11)
On Max
docker.fo... | Prometheus | 54,397,463 | 42 |
I was curious concerning the workings of Prometheus. Using the Prometheus interface I am able to see a drop-down list which I assume contains all available metrics. However, I am not able to access the metrics endpoint which lists all of the scraped metrics. The http://targethost:9090/metrics endpoint only displays th... | The endpoint for that is http://localhost:9090/api/v1/label/__name__/values
API Reference
| Prometheus | 58,319,911 | 41 |
Every instance of my application has a different URL.
How can I configure prometheus.yml so that it takes path of a target along with the host name?
scrape_configs:
- job_name: 'example-random'
# Override the global default and scrape targets from this job every 5 seconds.
scrape_interval: 5s
static_configs:
... | You currently can't configure the metrics_path per target within a job but you can create separate jobs for each of your targets so you can define metrics_path per target.
Your config file would look something like this:
scrape_configs:
- job_name: 'example-target-1'
scrape_interval: 5s
metrics_path: /target-... | Prometheus | 44,927,130 | 40 |
I am using Prometheus to monitor my Kubernetes cluster. I have set up Prometheus in a separate namespace. I have multiple namespaces and multiple pods are running. Each pod container exposes a custom metrics at this end point, :80/data/metrics . I am getting the Pods CPU, memory metrics etc, but how to configure Promet... | You have to add this three annotation to your pods:
prometheus.io/scrape: 'true'
prometheus.io/path: '/data/metrics'
prometheus.io/port: '80'
How it will work?
Look at the kubernetes-pods job of config-map.yaml you are using to configure prometheus,
- job_name: 'kubernetes-pods'
kubernetes_sd_configs:
... | Prometheus | 53,365,191 | 39 |
I have Prometheus scraping metrics from node exporters on several machines with a config like this:
scrape_configs:
- job_name: node_exporter
static_configs:
- targets:
- 1.2.3.4:9100
- 2.3.4.5:9100
- 3.4.5.6:9100
When viewed in Grafana, these instances are assigned rather meaningle... | I just came across this problem and the solution is to use a group_left to resolve this problem. You can't relabel with a nonexistent value in the request, you are limited to the different parameters that you gave to Prometheus or those that exists in the module use for the request (gcp,aws...).
So the solution I used ... | Prometheus | 49,896,956 | 39 |
I'm using Grafana with Prometheus and I'd like to build a query that depends on the selected period of time selected in the upper right corner of the screen.
Is there any variable (or something like that) to use in the query field?
In other words, If I select 24hs I'd like to use that data in the query.
| There are two ways that I know:
You can use the $__interval variable like this:
increase(http_requests_total[$__interval])
There is a drawback that the $__interval variable's value is adjusted by resolution of the graph, but this may also be helpful in some situations.
This approach should fit your case better:
... | Prometheus | 47,141,967 | 38 |
I need to monitor very different log files for errors, success status etc. And I need to grab corresponding metrics using Prometheus and show in Grafana + set some alerting on it. Prometheus + Grafana are OK I already use them a lot with different exporters like node_exporter or mysql_exporter etc. Also alerting in new... | Take a look at Telegraf. It does support tailing logs using input plugins logparser and tail. To export metrics as prometheus endpoint use prometheus_client output plugin. You also may apply on the fly aggregations. I've found it simpler to configure for multiple log files than grok_exporter or mtail
| Prometheus | 41,160,883 | 38 |
When deciding between Counter and Gauge, Prometheus documentation states that
To pick between counter and gauge, there is a simple rule of thumb: if
the value can go down, it is a gauge. Counters can only go up (and
reset, such as when a process restarts).
They seem to cover overlapping use cases: you could use a... | From a conceptual point of view, gauge and counter have different purposes
a gauge typically represents a state, usually with the purpose of detecting saturation.
the absolute value of a counter is not really meaningful, the real purpose is rather to compute an evolution (usually a utilization) with functions like ira... | Prometheus | 58,674,087 | 37 |
I want to add my HTTPS target URL to Prometheus, an error like this appears:
"https://myDomain.dev" is not a valid hostname"
my domain can access and run using proxy pass Nginx with port 9100(basically I made a domain for node-exporter)
my configuration prometheus.yml
scrape_configs:
- job_name: 'prometheus'
st... | Use the following configuration:
- job_name: 'domain-job'
scheme: https
static_configs:
- targets: ['myDomain.dev']
| Prometheus | 68,435,536 | 35 |
Prometheus running inside a docker container (version 18.09.2, build 6247962, docker-compose.xml below) and the scrape target is on localhost:8000 which is created by a Python 3 script.
Error obtained for the failed scrape target (localhost:9090/targets) is
Get http://127.0.0.1:8000/metrics: dial tcp 127.0.0.1:8000: g... | While not a very common use case.. you can indeed connect from your container to your host.
From https://docs.docker.com/docker-for-mac/networking/
I want to connect from a container to a service on the host
The host has a changing IP address (or none if you have no network
access). From 18.03 onwards our recommenda... | Prometheus | 56,909,896 | 35 |
I want to select all metrics that don't have label "container". Is there any possibility to do that with prometheus query?
| Try this:
{__name__=~".+",container=""}
There needs to be at least one non-empty matcher (hence the + in the __name__ regular expression, * wouldn't cut it). And the way you query for a missing label is by checking for equality with the empty string.
| Prometheus | 51,293,895 | 35 |
Is there a way to group all metrics of an app by metric names? A portion from a query listing all metrics for an app (i.e. {app="bar"}) :
ch_qos_logback_core_Appender_all_total{affiliation="foo",app="bar", instance="baz-3-dasp",job="kubernetes-service-endpoints",kubernetes_name="bar",kubernetes_namespace="foobarz",kube... | The following query lists all available metrics:
sum by(__name__)({app="bar"})
Where bar is the application name, as you can see in the log entries posted in the question.
| Prometheus | 49,135,746 | 35 |
I've found that for some graphs I get doubles values from Prometheus where should be just ones:
Query I use:
increase(signups_count[4m])
Scrape interval is set to the recommended maximum of 2 minutes.
If I query the actual data stored:
curl -gs 'localhost:9090/api/v1/query?query=(signups_count[1h])'
"values":[
... | This is known as aliasing and is a fundamental problem in signal processing. You can improve this a bit by increasing your sample rate, a 4m range is a bit short with a 2m range. Try a 10m range.
Here for example the query executed at 1515722220 only sees the 580@1515722085.194 and 581@1515722205.194 samples. That's an... | Prometheus | 48,218,950 | 35 |
We graph a timeseries with sum(increase(foo_requests_total[1m])) to show the number of foo requests per minute. Requests come in quite sporadically - just a couple of requests per day. The value that is shown in the graph is always 1.3333. Why is the value not 1? There was one request during this minute.
| The challenge with calculating this number is that we only have a few data points inside a time range, and they tend not to be at the exact start and end of that time range (1 minute here). What do we do about the time between the start of the time range and the first data point, similarly the last data point and the e... | Prometheus | 38,665,904 | 35 |
What are the differences between Prometheus and Zabbix?
| Both Zabbix and Prometheus may be used in various monitoring scenarios, and there isn't any particular specialization in either of these. Zabbix is older than Prometheus and probably more stable, with more ready-to-use solutions.
Zabbix has a core written in C and a web UI based on PHP. Also it uses "agents" (client-si... | Prometheus | 35,305,170 | 35 |
I'm attracted to prometheus by the histogram (and summaries) time-series, but I've been unsuccessful to display a histogram in either promdash or grafana. What I expect is to be able to show:
a histogram at a point in time, e.g. the buckets on the X axis and the count for the bucket on the Y axis and a column for each... | Grafana v5+ provides direct support for representing Prometheus histograms as heatmap.
http://docs.grafana.org/features/panels/heatmap/#histograms-and-buckets
Heatmaps are preferred over histogram because a histogram does not show you how the trend changes over time. So if you have a time-series histogram, then use the... | Prometheus | 39,135,026 | 34 |
Prometheus is built around returning a time series representation of metrics. In many cases, however, I only care about what the state of a metric is right now, and I'm having a hard time figuring out a reliable way to get the "most recent" value of a metric.
Since right now it's getting metrics every 30 seconds, I tri... | All you need is my_metric, which will by default return the most recent value no more than 5 minutes old.
| Prometheus | 40,729,406 | 34 |
I try to get Total and Free disk space on my Kubernetes VM so I can display % of taken space on it. I tried various metrics that included "filesystem" in name but none of these displayed correct total disk size. Which one should be used to do so?
Here is a list of metrics I tried
node_filesystem_size_bytes
node_filesys... | According to my Grafana dashboard, the following metrics work nicely for alerting for available space,
100 - ((node_filesystem_avail_bytes{mountpoint="/",fstype!="rootfs"} * 100) / node_filesystem_size_bytes{mountpoint="/",fstype!="rootfs"})
The formula gives out the percentage of available space on the poin... | Prometheus | 57,357,532 | 33 |
ElasticSearch is a document store and more of a search engine, I think ElasticSearch is not good choice for monitoring high dimensional data as it consumes lot of resources. On the other hand prometheus is a TSDB which is designed for capturing high dimensional data.
Anyone experienced in this please let me know what'... | ELK is a general-purpose no-sql stack that can be used for monitoring. We've successfully deployed one on production and used it for some aspects of our monitoring system. You can ship metrics into it (if you wish) and use it to monitor them, but its not specifically designed to do that. Nor does the non-commercial ver... | Prometheus | 40,793,901 | 33 |
I'm trying to write a prometheus query in grafana that will select visits_total{route!~"/api/docs/*"}
What I'm trying to say is that it should select all the instances where the route doesn't match /api/docs/* (regex) but this isn't working. It's actually just selecting all the instances. I tried to force it to select ... | May be because you have / in the regex. Try with something like visits_total{route=~".*order.*"} and see if the result is generated or not.
Try this also,
visits_total{route!~"\/api\/docs\/\*"}
If you want to exclude all the things that has the word docs you can use below,
visits_total{route!~".*docs.*"}
| Prometheus | 54,813,545 | 31 |
I'm displaying Prometheus query on a Grafana table.
That's the query (Counter metric):
sum(increase(check_fail{app="monitor"}[20m])) by (reason)
The result is a table of failure reason and its count.
The problem is that the table is also showing reasons that happened 0 times in the time frame and I don't want to displa... | I don't know how you tried to apply the comparison operators, but if I use this very similar query:
sum(increase(up[1d])) by (job)
I get a result of zero for all jobs that have not restarted over the past day and a non-zero result for jobs that have had instances restart.
If I now tack on a != 0 to the end of it, all ... | Prometheus | 54,762,265 | 31 |
I have a query:
node_systemd_unit_state{instance="server-01",job="node-exporters",name="kubelet.service",state="active"} 1
I want the label name being renamed (or replaced) to unit_name ONLY within the node_systemd_unit_state metric. So, desired result is:
node_systemd_unit_state{instance="server-01",job="node-exporte... | you can use the label_replace function in promQL, but it also add the label, don't replace it
label_replace(
<vector_expr>, "<desired_label>", "$1", "<existing_label>", "(.+)"
)
label_replace(
node_systemd_unit_state{instance="server-01",job="node-exporters",name="kubelet.service",state="active"},
"unit_name","$1","... | Prometheus | 54,235,797 | 31 |
I have a metric varnish_main_client_req of type counter and I want to set up an alert that triggers if the rate of requests drops/raises by a certain amount in a given time (e.g. "Amount of requests deviated in the last 2 min!").
Using the deriv() function should work much better than comparing relative values, but it ... | Solution
It's possible with the subquery-syntax (introduced in Prometheus version 2.7):
deriv(rate(varnish_main_client_req[2m])[5m:10s])
Warning: These subqueries are expensive, i.e. create very high load on Prometheus.
Use recording-rules when you use these queries regularly (in alerts, etc.).
Subquery syntax
<instan... | Prometheus | 40,717,605 | 30 |
I currently have the following Promql query which allow me to query the memory used by each of my K8S pods:
sum(container_memory_working_set_bytes{image!="",name=~"^k8s_.*"}) by (pod_name)
The pod's name is followed by a hash defined by K8S:
weave-net-kxpxc
weave-net-jjkki
weave-net-asdkk
Which all belongs to the same... | You can use label_replace
sum(label_replace(container_memory_working_set_bytes{image!="",name=~"^k8s_.*"}, "pod_set", "$1", "pod_name", "(.*)-.{5}")) by (pod_set)
You will be including a new label (pod_set) that matches the first group ($1) from matching the regex over the pod_name label. Then you sum over the new lab... | Prometheus | 51,614,030 | 29 |
There are times when you need to divide one metric by another metric.
For example, I'd like to calculate a mean latency like that:
rate({__name__="hystrix_command_latency_total_seconds_sum"}[60s])
/
rate({__name__="hystrix_command_latency_total_seconds_count"}[60s])
If there is no activity during the specified time pe... |
If there is no activity during the specified time period, the rate() in the divider becomes 0 and the result of division becomes NaN.
This is the correct behaviour, NaN is what you want the result to be.
aggregations work OK.
You can't aggregate ratios. You need to aggregate the numerator and denominator separately... | Prometheus | 47,056,557 | 29 |
We have a hierachical prometheus setup with some server scraping others.
We'd like to have some servers scrape all metrics from others.
Currently we try to use match[]="{__name__=~".*"}" as a metric selector, but this gives the error parse error at char 16: vector selector must contain at least one non-empty matcher.
I... | Yes, you can do: match[]="{__name__=~".+"}" (note the + instead of * to not match the empty string).
Prometheus requires at least one matcher in a label matcher set that doesn't match everything.
| Prometheus | 39,249,048 | 29 |
I'm running prometheus inside kubernetes cluster.
I need to send queries to Prometheus every minute, to gather information of many metrics from many containers. There are too match queries, so I must combine them.
I know how I can ask Prometheus for one metric information on multiple containers: my_metric{container_na... | I found here this solution: {__name__=~"metricA|metricB|metricC",container_name=~"frontend|backend|db"}.
| Prometheus | 47,406,624 | 28 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.