How to separate logs of uWSGI? - uwsgi

I want to separate the logs of uwsgi like access logs, request logs, error logs in individual files. At the moment these all are in same file and not well formatted.

There are configuration directives to specify different loggers for requests and all other messages: logger and req-logger. Example:
# uwsgi.ini
req-logger = file:/var/log/uwsgi/uwsgi-req.log
logger = file:/var/log/uwsgi/uwsgi.log
If you want nondefault formatting, filtering or a peculiar output location, you could write your own logging plugin. Here's a link the relevant page: http://uwsgi-docs.readthedocs.org/en/latest/Logging.html

Related

Jmeter parametrize WebSocket variable

I doing test backend application (also Java and Node JS, communication: WebSocket in NodeJs part and http in Java part) in JMeter
I must parametrize url, to switch between development url, production and prepod
I did it by CSV file. I created folder CSV, in folder where I have Jmeter 5.0. I prepare 3 csv file
1.development are:
protocol, host
http, 10.219.227.66
2.prepod
protocol, host
https, prepod.myprepod.io
3.production
protocol, host
https, production.myproduction.io
I set this that:
CSV Data Set Config
Filename ${_P()/usr/local/Cellar/jmeter/5.0/libexec/CSV/development,development}.csv
variable Names ; protocol,host
WebSocket Open Connection
Server name or IP ${host}
Switch Controller
Switch Value ${protocol}
HTTP Request Default - server name or ip ${host}, protocol http ${protocol}
User defined variables
name value
protocol . ${_P(protocol,)}
host . ${_P(host,)}
Questions are:
What is wrong in my set this? what and how i must improve?
I project test save in desktop,but Jmeter 5.0 i have in others places in my computer - in users is folder jmeter 5 - if this could be a problem?
Does anyone know why it does not work for me and how to fix it?.
Everything is wrong
Given you defined protocol and host variables in the CSV file you don't need to declare them in the CSV Data Set Config, just leave the field blank
JMeter supports CSV files which have a header line defining the column names. To enable this, leave the "Variable Names" field empty. The correct delimiter must be provided.
Don't use full paths to CSV files as most probably it will make running tests on other machines, in distributed mode or in continuous integration server impossible.
so go for something like ${__P(environment,development)}.csv
Double check that protocol and host variables have expected values using Debug Sampler and View Results Tree listener combination
If you don't see them - check jmeter.log file for any suspicious entries, most probably JMeter cannot find .csv file and read variables from it. See How to Debug your Apache JMeter Script article for more details.
I fail to see any WebSocket URL schema (ws or wss) in your CSV files so I doubt your WebSocket Open Connection Server will ever be successfully executed.

How to configure getting statsd performance metrics into graphite?

This question mentions two types of performance stats:
carbon.*: Stats from graphite itself.
stats.* : Stats from statsd.
I am seeing 1., but I'm not seeing 2.
Is there a statsd configuration setting (e.g. some entry in the js file) which will let me see 2.?
(2) should be generated by default, but the default prefix is statsd. and not stats. as you've said. Maybe check that you don't have any Graphite rules expecting the wrong prefix.
You can also configure the prefix to whatever you want using the prefixStats property in the .js config file.
See the documentation in the example config:
https://github.com/etsy/statsd/blob/master/exampleConfig.js

Is there a way to send files AS-IS via Fluentd?

I'm trying to use using Fluentd to aggregate log files from various servers. And by default it parses the log lines in various ways (and I can see the value in doing that) but in my current situation I would like to send the files AS-IS, without parsing and without changing a thing.
I'm using the in_tail plugin with the following configurations:
<source>
type tail
format none
read_from_head true
path /path/to/logs/*.log
pos_file /path/to/logs/pos_file
tag mylog
</source>
And even this none format parses the logs. For example
I am a line of log
gets parsed as
{"message":"hello world. I am a line of log!"}
I guess the question is: Is there a way for it to send the tail content, without altering anything?
Thanks!
Well, all messages in fluentd will be handled as JSON objects but what you could do is on the receiving end match with a file output (out_file) and that would basically just create log files on the receiving end with the same content as the source.
http://docs.fluentd.org/articles/out_file
You could even "hack" it to output with the format csv and set the delimiter to a whitespace. That could also work...

Logging with Grails , choosing log file at runtime

I'm working on a Grails 2.3.6 application
Assuming I have multiple users, I want to have for each one a different log file, is it possible to dynamically choose which log file to use at runtime?
You can use the Commons logging api manually. The documentation says you can use something like:
class MyClass {
private static final log = LogFactory.getLog(this)
}
The commons API documentation says you can create a log by String, too, so you could create logs with LogFactory.getLog(userName) and store them somewhere, perhaps in a Map, then retrieve the right one when you need to log, e.g. loggers[userName].info "Client did X"

How to redirect println output from console to specified log file in grails using log4j (Config.groovy)

In my application I use println "Some text here ${var}" statements to send some "debug" info to the console. But I want to send data to the specified file.
Could it be done via configuration of Config.groovy file?
You can't. Log messages have to go through log4j for them to be handled by Grails and log4j.
What you could do is replace all instances of println in your code with log.debug; that should be a simple search and replace with your text editor or IDE.
If that isn't possible you could try to replace the global System.out object with a File-backed PrintStream object in BootStrap.groovy.
You should to use logger directly. It's easy, clean, documented and flexible.
http://grails.org/doc/latest/guide/single.html#logging

Resources