Logstash Shipper configuration for Jira - logstash

I am running Jira and Confluence within my company. I would like the logfiles to be shipped to Kibana.
This is very easy to do but I do not want to rewrite the Grok filters. I cannot imagine that nobody has done this already.
Does anybody have an example of a logstash shipper configuration. Most of the logging like catalina.log is standard.
Please help me with examples

One would think that Java application logs only come in one form, but my experience is that there often are subtle differences. Sometimes the thread name is in square brackets and sometimes in parentheses, sometimes the thread name goes first and other times after the logger name, and so on. This gets more painful as you attempt to parse more than one type of log.
Instead of messing with various filters to join multiline messages and grok all the fields I strongly favor using the Log4j layout in github.com/logstash/log4j-jsonevent-layout to produce JSON-based logs that Logstash can read directly without any filters. Apart from not having to maintain filters you get all fields from each log event. Since I don't know what your catalina.log looks like I can't say what you'd be missing by parsing its contents instead of using the JSON layout.
The drawback is that it's a bit more work deployment-wise. You obviously have to deploy the layout jar file itself, but it has a couple of dependencies of its own (net.minidev:jsonsmart and commons-lang:commons-lang) that you need to make available too.

Related

How to filter uvm_info messages by type_id?

I need to filter all the uvm_info log messages by the type_id defined in it. For example, if I want to display only the uvm_info messages from a driver or a monitor, how can I effectively do it?
The UVM does not provide a mechanism to do this very easily. You would have to set the verbosity of everything to UVM_NONE from the top-level down, then go back and turn on just the messages from the drivers and monitors.
Finding al the drivers and monitors might also be difficult unless you gave specific component names, like starting with "drv" and "mon". Then you could use uvm_root::find_all("drv*",comps); and set the verbosity of those components in comps back to UVM_FULL.
It might be easier just to take the entire log file and filter the results you want using a (sed/awk/perl/python) script
How about a custom report catcher?
https://verificationacademy.com/verification-methodology-reference/uvm/docs_1.1d/html/files/base/uvm_report_catcher-svh.html
You can put this in your base test or top, then perhaps control this using a plusarg. A rudimentary example is here:
https://edaplayground.com/x/b4Fx
I think I am quite late to answer this question, however some time ago I wrote a program to filter UVM logs: https://github.com/Loneknight73/uvmlogfilter .
You can filter on, e.g., severity, id, time, component hierarchy and the message text.
That should help anyone who needs to filter verbose UVM logs.

Quire API Task.tags are always empty

i use the API to read my projects and tasks with C#. This works like a charm.
I read my tasks with the following endpoints.
https://quire.io/api/task/list/{project.oid}
and
https://quire.io/api/task/list/{task.oid}
However, the tasks have no references to the assigned tags. In the JSON-response the tags-property is always an empty array. But most of my tasks have at least one tag assigned.
Is this a known bug or did i miss something in the documentation?
Thanks for your Help.
I verified the api endpoints you describe. And in my case they result in the expected tags being listed per task. On both root tasks for a {project.oid} and subtasks for another {task.oid}.
Here a screenshot of what I get from command line (formatted the output using jq)
compared to the view inside quire:
So the answers to your questions...
No it's not a known bug on our side, and it doesn't look you missed anything based on your description. Maybe the URLs and results from my screenshots give you something to compare with.
If the problem persists on your side you can also contact support#quire.io with additional information you can't share in public.

log4net configuration: Can I refer to the same layout in several appenders?

I want to send log messages to several files (i.e. different appenders) based upon some property of the message.
The problem is that each appender needs to specify quite a verbose layout (that contains a compication conversionPattern and a couple of converters). I have ended up duplicating this configuration in each appender. This works but is not ideal as it makes the config much longer than I would like as well as the pain of having to update 3 complicated bit of configuration when the layout changes.
I want to be able to define the layout once and have all my appenders refer back to that one definition (in the same way that several loggers can refer to the same appender). But perhaps there is a better way to achieve my goal of reducing duplication in the configuration?
My google-foo is weak and I could not find an answer. Can anyone here help?
TIA.
I am sorry but unless you are ready to code your own Layout class there is currently no way to skip on the copy-pasted configuration.
You can inherit from the LayoutSkeleton to get started, and either build your layout in code or use an alternate configuration file (I don't think that log4net would be kind to a dangling layout configuration in its config file)

Any way in Expression Engine to simulate Wordpress' shortcode functionality?

I'm relatively new to Expression Engine, and as I'm learning it I am seeing some stuff missing that WordPress has had for a while. A big one for me is shortcodes, since I will use these to allow CMS users to place more complex content in place with their other content.
I'm not seeing any real equivalent to this in EE, apart from a forthcoming plugin that's in private beta.
As an initial test I'm attempting to fake shortcodes by using delimited strings (e.g. #foo#) in the content field, then using a regex to pull those out and pass them to a function that can retrieve the content out of EE's database.
This brings me to a second question, which is that in looking at EE's API docs, there doesn't appear to be a simple means of retrieving the channel entries programmatically (thinking of something akin to WP's built-in get_posts function).
So my questions are:
a) Can this be done?
b) If so, is my method of approaching it reasonable? Or is there something stupidly obvious I'm missing in my approach?
To reiterate, my main objective here is to have some means of allowing people managing content to drop a code in place in their content that will be replaced with channel content.
Thanks for any advice or help you can give me.
Here's a simple example of the functionality you're looking for.
1) Start by installing Low Replace.
2) Create two Global Variables called gv_hello and gv_goodbye with the values "Hello" and "Goodbye" respectively.
3) Put this text into the body of an entry:
[say_hello]
Nice to see you.
[say_goodbye]
4) Put this into your template, wrapping the Low Replace tag around your body field.
{exp:low_replace
find="[say_hello]|[say_goodbye]"
replace="{gv_hello}|{gv_goodbye}"
multiple="yes"
}
{body}
{/exp:low_replace}
5) It should output this into your browser:
Hello
Nice to see you.
Goodbye
Obviously, this is a really simple example. You can put full blown HTML into your global variable. For example, we've used that to render a complex, interactive graphic that isn't editable but can be easily dropped into a page by any editor.
Unfortunately, due to parse order issues, EE tags won't work inside Global Variables. If you need EE tags in your short code output, you'll need to use Low Variables addon instead of Global Variables.
Continued from the comment:
Do you have examples of the kind of shortcodes you want to support/include? Because i have doubts if controlling the page-layout from a text-field or wysiwyg-field is the way to go.
If you want editors to be able to adjust layout or show/hide extra parts on the page, giving them access to some extra fields in the channel, is (imo) much more manageable and future-proof. For instance some selectfields, a relationship (or playa) field, or a matrix, to let them choose which parts to include/exclude on a page, or which entry from another channel to pull content from.
As said in the comment: i totally understand if you want to replace some #foo# tags with images or data from another field (see other answers: nsm-transplant, low_replace). But, giving an editor access to shortcodes and picking them out, is like writing a template-engine to generate ee-template code for the ee-template-engine.
Using some custom fields to let editors pick and choose parts to embed is, i think, much more manageable.
That being said, you could make a plugin to parse the shortcodes from a textareas content, and then program a lot, to fetch data from other modules you want to support. For channel entries you could build out of the channel data library by objectiveHTML. https://github.com/objectivehtml/Channel-Data
I hear you, I too miss shortcodes from WP -- though the reason they work so easily there is the ubiquity of the_content(). With the great flexibility of EE comes fewer blanket solutions.
I'd suggest looking at NSM Transplant. It should fit the bill for you.
There is also a plugin called Shortcode, which you can find here at
Devot-ee
A quote from the page:
Shortcode aims to allow for more dynamic use of content by authors and
editors, allowing for injection of reusable bits of content or even
whole pieces of functionality into any field in EE

Using log4net to create logfiles that can be viewed with SvcTraceViewer.exe

What is the best way to log to a file using log4net that has the correct format (correct XML, correct timestamp format, custom data in correct format, correct attributes, basically the exact same way as XmlWriterTraceListener does it) so it can be viewed in the Service Trace Viewer Tool (SvcTraceViewer.exe)?
If I wanted to this then I would write my custom layout. I did not (yet) look at the details but I would write a class that derives from XmlLayoutBase. I need some more time to look at the details...
You could also write your own appender but I think in this case it makes more sense to write a layout class.
Edit: Maybe writing your own appender is a good idea. In that case you could use the System.ServiceModel.Diagnostics.DiagnosticTrace class. Not sure yet though if that is the way to go. I do not have much time right now, but I will look into this.
Not an answer, but I asked a question earlier today about logging and WCF and one of the things I wanted to know was about Service Trace Viewer. All of the examples that I have seen describe the XML files consumed by Service Trace Viewer being generated via System.Diagnostics TraceSources and the System.Diagnostics XmlFileListener. Anyway, if I get any answers in my post you might find them useful.
Here is an idea:
You could write a custom log4net Appender and have it write messages (indirectly) to the XmlWriterTraceListener. Inside the Append method you simply send the message to System.Diagnostics.
Here is one example of a custom Appender.
In the example, Append is overridden. It is passed a LoggingEvent class/structure. For your purposes (to get the log4net output routed to an output format that can be read by SvcTraceViewer), you could write your output to System.Diagnostics (having first configured it to log to the XmlWriterTraceListener). You could either write using Trace.Write* methods, Trace.Trace* methods, or by TraceSources.
For TraceSources, you could consider the TraceSource name to be the same as the logger name (which is available in the LoggingEvent class/structure). So, you could configure a TraceSource in your app.config file for each log4net logger name that you want to go into the xml file. Your Append logic then might look something like this:
protected override void Append(LoggingEvent le)
{
TraceSource ts = new TraceSource(le.LoggerName); // Not sure of logger name field in LoggingEvent
ts.TraceEvent(LogLevelToTraceEventType(le.Level), 0, le.FormattedMessage);
}
This might give you what you want. Note that I have not actually done this, so I cannot say if it is a good idea or not, but it certainly seems like it would work.
Sorry for being brief, but am trying to finish this before have to leave.

Resources