Why wildcards doest work properly in logstash - logstash

im using this file input to read logs from
logpath/sisi/$STAGE
logpath/sisigeo/$STAGE
file {
path => "###logpath###/sis*/###stage###/monitoring/*.log"
The wildcard
sisi*
doesnt work. so im using
sis*
instead.
My understanding of wildcard (*) is none or more characters are following (bash like), but in logstash this is not true, bug or feature or something else ?

Related

How to make logstash file input work on windows machine?

I have a runningversion of logstash on my windows machine.
The file input filter does not work. The logstash script starts and nothing happens -> no success or error.
Generate input filter, and stdin all work properly.
The file input filter stopped working after 2-3 days.
The file output filter works fine.
PFB my settings.
file {
path => "D:\softwares\logstash\data\sample4.txt"
# path => "D:/softwares/logstash/data/sample4.txt"
start_position => "beginning"
sincedb_path => "NUL"
ignore_older => 0
}
ignore_older => 0
In filebeat, setting ignore_older to zero turns off age based filtering. For a logstash file input it ignores any files more than zero seconds old, which can result in it ignoring all files. Delete this option.
Also, ever since the conversion of logstash core from ruby to java, a backslash in the path option is treated as an escape, so path => "D:\softwares\logstash\data\sample4.txt" is treated as if it were path => "D:softwareslogstashdatasample4.txt". Use forward slash instead.

Logstash not running

I've a logstash instance, version 2.3.1 which isn't running using the command
sudo service logstash start
Whenever I run this command, it returns logstash started and after a few moments when I check the status, I find that logstash isn't running. Although, when I start the logstash from opt to get output on the terminal, it runs without any error.
Note that logstash.err and logstash.stdout files are empty and logstash.log file isn't anywhere to be found. I've also set LS_GROUP to adm in init.d which caused the same issue on another instance, but even that doesn't seem to work now. Any help would be appreciated!
On an Ubuntu system, this behavior can be seen by logstash. To get around it, you can change the logstash user group in /etc/init.d/logstash to adm which stands for admin and you're good to go.
This is normal behaviour of Logstash.
Can you test if your Logstash instance is working correctly?
Windows:
Go to your bin folder of logstash
and type logstash
Linux:
Enter this command in the prompt (bin folder of your logstash instance)
/opt/logstash/bin/logstash
Both:
If you get No command given ... you're logstash instance has the correct setup.
You can always run your Logstash instance with this command
logstash -e 'input { stdin { } } output { stdout {} }'
After this you can enter some text values and they will output to your console.
If this all works you can be sure that your Logstash instance is running correctly.
You may ask yourself why is this? This is because Logstash waits to start untill it gets a config to run with or another option.
If you want to start Logstash automatically on startup. You need to use this command.
sudo update-rc.d logstash defaults 96 9
Actually,you should read the guide of logstash.In the "getting started section",The official documentation has the corret way for you to start a logstash work.
First,you should write a configure file such as "std.conf",look like this:
input {
stdin {
}
}
output{
stdout{
codec=>rubydebug
}
}
Then,start your logstash:
bin/logstash -f conf/std.conf
If you want this work can run in the background(such as get some log files into elasticsearch),you may also need add "&" in the end of the command,like this:
bin/logstash -f conf/getlog.conf &
with this file(std.conf) and this command,your logstash will start up and if you type any word in you terminal,it will print out in the terminal,like this:
{
"message" => "hello",
"#version" => "1",
"#timestamp" => "2016-08-06T19:47:36.543Z",
"host" => "bag"
}
Now,you have got the normal operation of logstah,you may need more information,from there:The official documentation of logstash
Try this,and keep going,it`s easy for you~

Perl color specifiers with redirected output

I have a Perl script that uses Term::ANSIColor. It used to be the case that if I redirect the output to a file > file.txt then the file contains just the text, and not the color codes ^[[0m
Something changed on my machine, Ubuntu 10.04, such that redirected output includes these special characters that specify color.
Any idea how to fix this? Can I detect output redirection from inside the perl script and skip the color part?
Thanks!
You can test whether you're running interactively using the IO::Interactive package:
use IO::Interactive qw(is_interactive);
if (is_interactive())
{
# show some fancy color
}
The rationale behind using IO::Interactive (instead of just testing if STDIN is a tty with the -t operator) is extensively explained by Damian Conway.

cannot save the results of find command in a file - file is empty

The program is supposed to find a file and return whether it exists on the system or not, now i have found that find command should be used, but since this command will be initiated by the code (using System) i need to save the results in a file, and trying on the terminal, i cannot get it to work, the result doesn't appear in the file, i am trying:
find / -name 'test2abc' 2>/dev/null -> res
The file res is empty. How to do it right?
Also is there a better way to do it, i am supposed to print the details of the file using stat command if the file exists. Is there a way to use juts the stat command to search for the file in the subfolders as well?
The -> res part should be > res only.
If you try the command like this on the commandline:
find / -name 'test2abc' -> res
it will print an error:
find: paths must precede expression: -
The - is not part of any valid redirection and hence given to find which cannot interpret it either.
It may be wise not to suppress error messages. A simple way can be redirecting both stderr and stdout to the file like this:
find / -name 'test2abc' > res 2>&1
Then the error about the - would have been in the file right from the start you you would have known what`s wrong very fast.

CCNetConfig command line parameter for opening a ccnet.config?

I'm trying out CCNetConfig (warning, website a little slow). Great app, one annoyance.
I can see in the documentation and even in the source code (Look at the end of the Initialize method) that I should be able to pass in a command line parameter to automatically load the configuration file.
I have tried:
-f E:\CruiseControl.Net\server\ccnet.config
-file E:\CruiseControl.Net\server\ccnet.config
-f=E:\CruiseControl.Net\server\ccnet.config
-file=E:\CruiseControl.Net\server\ccnet.config
And the same 4 switches with quotes around the file name just in case.
They all produce errors or just don't work. Has anyone had success doing this?
Thanks in advance.
Try moving it to a different path. Try the simplest thing: c:\ccnet.config.
I'm guessing it's the source of the problem because I recall CCNetConfig gave me sh!t early on when I tried to open files in paths that had spaces in them (e..g in Program Files).
According to my version of CCNet the command line flag for using a different config file is -c or --config, so the following should do it...
-c "E:\CruiseControl.Net\server\ccnet.config"
...which works for me.
I don't know why it uses a non-standard flag, but there you go.

Resources