Parsing intertwined multiline logs with logstash - multithreading

I am trying to parse logs that are of the following form:
07/12/16 00:41:03.30 FABsrv.1:fwsrvExecServerRule:FwSelectRawSqlTxn stopped at 00:41:03 , and took 0.000413000
07/12/16 00:41:03.30 FABsrv.1:fwsrvExecServerRule:FwSelectRawSqlTxn started at 00:41:03
07/12/16 00:41:03.30 FABsrv.1:fwsrvExecServerRule:FwSelectRawSqlTxn stopped at 00:41:03 , and took 0.000450000
07/12/16 00:41:03.30 FABsrv.15:FwEventManager:message to process: :>>L FwSrvExecuteRuleTxn msgTag=_INBOX.0A121933.DC05784206C6061BD8.13 ruleName=C2_BATCHCHECK attributes={ { class=ASSOC { class=A1 "PARAMETER" } { class=A1 "VALUE" } } { "USERID" "BC212" } { "EQPID" "FAITU02" } { "LOTIDS" "Q619294" } { "LOTSPPIDS" "Q619294=B401HA/DEFFIN_A" } { "FORCENOMEASURE" "F" } { "FORCEBATCHMAX" "F" } { "TID" "CRO06666_RN004102950_V5.8.0.0004" } }
07/12/16 00:41:03.30 FABsrv.15:fwsrvExecServerRule:FwSelectRawSqlTxn started at 00:41:03
07/12/16 00:41:03.30 FABsrv.1:fwsrvExecServerRule:FwSelectRawSqlTxn started at 00:41:03
07/12/16 00:41:03.30 FABsrv.1:fwsrvExecServerRule:FwSelectRawSqlTxn stopped at 00:41:03 , and took 0.001052000
07/12/16 00:41:03.30 FABsrv.15:fwsrvExecServerRule:FwSelectRawSqlTxn stopped at 00:41:03 , and took 0.001576000
07/12/16 00:41:03.30 FABsrv.15:fwsrvExecServerRule:FwSelectRawSqlTxn started at 00:41:03
07/12/16 00:41:03.31 FABsrv.15:fwsrvExecServerRule:FwSelectRawSqlTxn stopped at 00:41:03 , and took 0.000910000
07/12/16 00:41:03.31 FABsrv.15:C2_BATCHCHECK:CAPITraceDiagnostic - finish executing rule C2_BATCHCHECK:Reply
They are generated by a pool of threads running on some server that all write to a single file and I need to extract information from blocks of them keeping in mind the following constraints:
Events are multiline, those stopped and started you see can have lines between them and those need to be joined together
Events are intertwined, the third column specifies which thread wrote which line and each thread needs to correspond to a different stream of data
I need a thread safe solution
That last point is the real problem, since what is currently in use is the multiline filter with its stream-identity option to split the stream based on the thread number, but that solution can't scale to the amount of data we have now and the mutiline filter is deprecated in favor ofmultiline-codec which is thread safe, but does not support that stream-splitting functionality.
Splitting the logs into mutiple files would be my obvious solution but this is not possible for operational reasons.
Is there any way to do this?

Related

Run Experiment via Feature and get VariationId of Experiment

Playing around with growthbook, and having a hard time, figuring out how to use experiments.
created experiment.
created feature, with experiment rule
now my feature has variations, and my experiment have variations.
in JS-Land, i do something like:
const growthbook = new GrowthBook({
apiHost: "http://localhost:3100",
clientKey: "sdk-ZzfdzxSSDuHgmpXG",
enableDevMode: true,
trackingCallback: (experiment, result) => {
console.log("Viewed Experiment", {
experimentId: experiment.key,
variationId: result.variationId
});
}
});
growthbook.setAttributes({
user_id: "ccc",
id: "cccc"
});
await growthbook.loadFeatures({ autoRefresh: true });
if (growthbook.isOn("my-test")) {
console.log("Feature is enabled!");
}
it works, but in fact the variationId in the console.log is actually the variation ID of the Feature itself.
question: how to get the variation id of the experiment, or what is the best way to run a experiment.
not quiet sure, how to trigger experiments, and how they are connected. (i understand, metric tracking and conversion tracking - but that requires to get the variationId)
or is it supposed to be - that variationId's on feature need to be done too on experiment?!

Warning message in capsule.bxb

I have created a sample bixby capsule and it was working fine till last week. I have opened the capsule today to find a warning message in my capsule.bxb file and my capsule stopped working.
Here is the warning message : WARN_DEPRECATED Add 'support-halt-effect-in-computed-inputs' to 'runtime-flags' and adjust to new behaviour: encountered halt effects during computed inputs will halt.
Below is the code in capsule.bxb file
capsule{
id (vobo.roqos_support)
version (0.1.0)
format (3)
targets {
target (bixby-mobile-en-US)
}
marketplace-constraints {
country-constraints {
allowed-list {
allow (US)
allow (CA)
}
}
device-model-constraints {
allowed-list {
allow (SM-G965N) // S9+ Korean version
allow (SM-G960[A-Z]?) // any variant of S9
}
}
}
}
The warning will go away if you add this to your capsule.bxb file.
runtime-flags {
support-halt-effect-in-computed-inputs
}
As for the "capsule stopped working", please update your question to provide more details on what that means.

UIView element not updating

I need to get data from a API I’ve used debug prinln’s and these print almost instantly including the information gotten from the API, but when I try to display this info to the user in the ViewController this takes around 30 seconds to display.
I will get the information from the API here
func httpGet(request: NSURLRequest!, callback: (NSData?, String?) -> Void) {
var session = NSURLSession.sharedSession()
var task = session.dataTaskWithRequest(request){
(data, response, error) -> Void in
if error != nil {
callback(nil, error.localizedDescription)
} else {
callback(data, nil)
}
}
task.resume()
}
I invoke the request and return a string for debugging
func loadSchedule() {
httpGet(request) {
(data, error) -> Void in
onComplete(“Milo Cesar”)
}
And here I will display the data to the user
#IBAction func settingsButtonPress(sender: AnyObject) {
println("Settings Button Pressed: Invoking Schedule")
Schedule().loadSchedule(){
(scheduleData) in
println("Found Schedule: Setting Title to \(scheduleData)")
self.settingsButton.setTitle(scheduleData, forState: UIControlState.Normal)
}
}
The whole process from the “Settings Button Pressed: Invoking Schedule” statement in my console till I get “Found Schedule: Settings Title to Milo Cesar” takes less than a second.
Since the name already gets displayed in that console log I think that the information has been loaded. Though it takes up to 35 seconds for the Button to change it’s title.
Why does it take so long for my UIButton to update it’s title after the data has been retrieved?
Are you sure you are updating its title in main thread? try to wrap it up in GCD
dispatch_async(dispatch_get_main_queue()){
self.settingsButton.setTitle(scheduleData, forState: UIControlState.Normal)
}
EDIT
it fixes it because everything UI related must be performed by main thread, its a restriction that comes directly from Apple. You can use background threads for long taking tasks(download data, perform long taking calculations or sort large arrays) but everything that needs to be displayed on your screen must be performed by main thread(tableview reload, animations, inserting text into label).
Also here is a great tutorial on GCD and its functionality: http://www.raywenderlich.com/60749/grand-central-dispatch-in-depth-part-1

AlloyUI Scheduler

I have played around with the AlloyUI Scheduler, and it seems to be the by far best calendar out there. While poking it, a few questions have risen. I am not particularly experienced with YUI, so my questions might be caused by lack of experience with the kind of thinking that goes with YUI. Nevertheless, here are the problems I haven't managed to overcome:
First, I tried loading 500+ events into it, and the result is that every action (adding events, deleting events, switching between views, switching between weeks/months) happens with a delay. Is this expected? 500 events doesn't sound like much, even for a relatively short period.
Can I limit the hours displayed in Day or Month view? I.e., instead of 00:00 - 23:59 I'd prefer to only display 08:00 - 17:59.
I've managed to translate bits of the UI, such as "Today", "Day", "Week", "Month", "Agenda", "Delete", "Save", "Cancel", "e.g., Dinner at Brian's". But how can I translate the days (e.g., "Monday", "Tuesday" etc)?
I've found a way to replace the default buttons of the EventRecorder's toolbar. But is there a way to keep the originals ("Save", "Cancel", "Delete") and add a few custom ones?
var eventRecorder = new Y.SchedulerEventRecorder({
toolbar: {
children: [
[
{
label: 'Details',
on: {
click: function () {
alert("Yeah!");
}
}
},
]
]
}
});
Is there a way to disable some periods of time for event creation? I'd imagine this could be achieved by interrupting the event creation by some way. Something in the lines of
scheduler.on({
'scheduler-events:add': function (event) {
return isEventAllowed();
}
});
What is the correct way for accessing the calendar event data in the case of events such as "scheduler-event:change", "scheduler-event-recorder:edit" or similar? I currently use scheduler.getEvents()[event.index]._state.data and eventRecorder.getUpdatedSchedulerEvent()._state.data, respectively. But using these smells funny.
What would be a recommended way for adding a detailed editing view for events? I currently hacked it with something in the lines of
scheduler.on({
'scheduler-base:click': function(event) {
var toolbar = $(".aui-scheduler-event-recorder-overlay .yui3-widget-ft .aui-toolbar-content .aui-btn-group");
if (!toolbar.data("custom-processed")) {
var button = $('<button class="aui-btn">Details</button>');
toolbar.append(button);
button.click(function (event) {
event.preventDefault();
var eventData = (eventRecorder.get("event") || eventRecorder.clone())._state.data;
// Creating my detailed editing window here
$(".aui-scheduler-event-recorder-overlay").addClass("yui3-overlay-hidden");
});
toolbar.data("custom-processed", true);
}
}
});
Thanks,

NSTimer in NSOperation subclass

Dear community.
I try to setup NSTimer:
#interface GetExternalInfo : NSOperation {
NSTimer *keepAliveTimerMain;
#property (nonatomic,retain) NSTimer *keepAliveTimerMain;
.m:
#synthesize keepAliveTimerMain
-(void) main;
{
self.keepAliveTimerMain = [NSTimer scheduledTimerWithTimeInterval:5 target:self selector:#selector(keepAlive:) userInfo:nil repeats:YES];
[keepAliveTimerMain fire];
[[NSRunLoop currentRunLoop] addTimer:self.keepAliveTimerMain forMode: NSDefaultRunLoopMode];
BOOL timerState = [keepAliveTimerMain isValid];
NSLog(#"STAT:Timer Validity is: %#", timerState?#"YES":#"NO");
- (void)keepAlive:(NSTimer *)theTimer
{
BOOL currentState = [self isCancelled];
NSLog(#"STAT:cancelled state is %#.\n",currentState?#"YES":#"NO");
}
In Logs
2011-02-02 18:58:31.041
snow[54705:5d07] STAT:cancelled state
is NO. 2011-02-02 18:58:31.042
snow[54705:5d07] STAT:Timer Validity
is: YES
i see this only once. No next repeat attempts every 5 seconds
any opinions in this case? GC is enabled.
Do you have a runloop in the current thread? The timer needs a runloop to be able to fire. I notice you call -fire manually which explains why -keepAlive is called, but this doesn't actually start the timer.
You need to add your timer to a run loop, something like [[NSRunLoop currentRunLoop] addTimer:keepAliveTimerMain forMode: NSDefaultRunLoopMode];.
EDIT: The code you posted shows that you manually fire the timer before adding it to the runloop. This will fire and invalidate the timer, so you are actually trying to schedule an invalid timer on the runloop. That is why you only see the NSLog message once.

Resources