I am wondering how to add a column with formatted text. I need to add tag to make multi line column in show Operation.
I found it:
$this->crud->addColumn(['name' => 'myName', 'label' => 'myLabel', 'type' => 'text', 'escaped' => false]);
So add index 'escaped' with value false.
Related
i want to add, using puppet, text in existing file in desired place. Structure of the file is as follows:
[OPTION1]
aaa
bbb
ccc
I want to add text between aaa and bbb. For now I have figured out how to add text at the end of the file with:
file { '/home/file.txt': ensure => present, } ->
file_line { 'Add text to /home/file.txt':
path => '/home/file.txt',
line => 'added_text'
Should I use awk or sed (i saw it somewhere on google) or there is another way?
file_line has an after parameter, which you should set to the line you want the text to be inserted after:
file_line { 'Add text to /home/file.txt':
path => '/home/file.txt',
line => 'added_text',
after => 'aaa',
}
See the file_line documentation for a full list of supported features.
Im using write_xlsx gem and having multiple select in excel(written in vba) and now i want single select in only one cell.
Is it possible to do with data_validation? or i have to modify with vba?
worksheet.data_validation('D2',
{
:validate => 'list',
:value => ['One', 'Two', 'Three']
})
Thanks
I have a Logstash filter set which sets a field Alert_level to an integer based on regex matching the message.
Example:
if [message] =~ /(?i)foo/ {mutate {add_field => { "Alert_level" => "3" }}}
if [message] =~ /(?i)bar/ {mutate {add_field => { "Alert_level" => "2" }}}
These cases are not mutually exclusive and will sometimes result in events with 2 or more values in Alert_level:
message => "foobar"
Alert_level => "2, 3"
I want to add up the values in Alert_level to a total integer, where the above example would result in this:
message => "foobar"
Alert_level => "5"
There is no math in logstash itself, but I like darth_vader's tag idea (if your levels are only hit once each).
You could set a tag for the alert levels, e.g. "alert_3", "alert_4", etc., and then drop into the ruby filter to loop across them, split out the numeric value, and add them together into a new field. (Using a sentinel prefix like "alert_" will prevent you from trying to add a "_grokparsefailure" or other non-alert tag).
There are other examples on SO for looping across fields in ruby.
As I understood your question, you need the AND operator within your if to check both the conditions:
if "foobar" in [message] and "5" in [Alert_level]{
//do something
}
I want to parse logfile with logstash which contains both single line and multiple line. [e.g first 2 lines with 1 line log entry whereas 3rd one has multiple line entry ]
ERROR - 2015-12-05 20:48:53 --> Could not find page
ERROR - 2015-12-05 20:48:53 --> Could not find VAR
ERROR - 2015-12-05 20:48:59 --> Array
(
[id] => 12344
[studentid] => 33
[fname] =>
[lname] =>
[address] => tokyo
)
This log entry is forwarded from client (logstatsh-forwarder) which sets type as "multilineclient"
filter{
if [type] == "multilineclient" {
multiline {
pattern => "^ERROR"
what => "previous"
}
grok{
match => {"message" => "%{LOGLEVEL:loglevel}\s+%{TIMESTAMP_ISO8601:timestamp}\s+%{DATA:message}({({[^}]+},?\s*)*})?\s*$(?<stacktrace>(?m:.*))?"}
}
mutate {
remove => [ "#loglevel" ]
}
}
}
I did try both Grok Debugger and grok constructer (but couldn't quite solve issue with LOGLEVEL being start of logfile ),
My multiline logs (array) are parsed as separate message.
message: [id] =>
message: [studentid] =>
message: [fname] =>
I was expecting this to come as single "message:"
Any suggestion?
The first step is to get multiline{} (codec or filter) working properly. When it does, you should end up with three documents based on your example.
Your multiline construct can be read as "when I find a line that begins with ERROR, keep it with the previous", which I don't think is what you want. Sounds like you should add the 'negate' option.
If that solves the multiline problem, then you should run one grok{} to pull the common stuff off the front (level, date, time). A second grok{} could then separate all the fields inside the parens from the rest. The data inside the parens could probably be fed to the kv{} ("key value") filter to produce fields from the key/value pairs.
Searching "follow back" in Twitter User's description field that I have indexed already with following mapping.
Note: Only Highlight some of mapping.
1.
'analysis' => array(
'analyzer' => array(
'myanalyzer' => array(
"type" => "standard",
'stopwords' => '_none_',
),
)
)
2.
$mapping->setParam('index_analyzer', 'myanalyzer');
$mapping->setParam('search_analyzer', 'myanalyzer');
3.
'description' => array('type' => 'string', "index" => "not_analyzed"),
4.
//search something
$queryString = new \Elastica\Query\QueryString();
$queryString->setDefaultOperator( "AND" );
// $queryString->setFields(array("user.description"));
$queryString->setQuery('follow back');
When Searched while setFields is commented it gives me lot of results like
IF YOU FOLLOW ILL FOLLOW BACK! :) 100% follow back! :)
Follow me i follow back :) instagram:juliemar25 i follow back
But after uncomment setFields and defaultOperator to AND, then it show no results.
AND by uncomment setFields and defaultOperator to OR, it shows me only results that have "follow" in description nothing else.
Q1: Why white space not working on setFields instead working with _all?
While Using Match Query
$matchQuery = new \Elastica\Query\Match();
$matchfield = "user.description";
$queryToMatch = "follow back";
$matchQuery->setFieldQuery($matchfield, $queryToMatch);
It also show only two results that have "follow back" only in description. But after changing to match field to _all it show lot of results that contains "follow back" in description field
Q2. Why it is happening? How can I search for space separated words?
This is because you have set "description" field to be not_analyzed as per the mapping above.
This would result in the description field payload being indexed as is and a match occurs when the 'description' field is an exact search phrase which in this case is "follow back"
Removing "index" => "not_analyzed" should fix it.