Splunk Search

How to check application running status hosted in Linux server using application log

mnarmada
Path Finder

Hello Team,

Here is my requirement:

I have to check the application running status, which is installed in Linux server.  For this, I have a log generated by the application, which might not contain the continuous-time intervals. The log will get updated when the user is using the app. In the log, I have 3 high priority exceptions: TransactionRolledbackException, WIMSystemException, ConnectionWaitTimeoutException. When any of these exceptions occurred in the log, the status should be "DOWN". If any other exceptions occur, then the status should be "WARNING, and if no exception, it should show "OK". Also once the high priority exception occurs, we will notify the users by email alert. After the email alert, it would be cleared then the next events will generate. once the next event generates and does not contain any high priority exceptions, then the status should be shown in the dashboard as "OK" and low priority exceptions, warning. And if the latest event contains exception again, then "DOWN". 

Noe: when the application is down in real time, the log will not generate.

Here are my sample codes but not satisfied with the results:

1.

index=myIndex sourcetype=mySourcetpe 
| stats count as Total earliest(_time) as start_time latest(_time) as latest_time earliest(_raw) as Earliest_Event latest(_raw) as Latest_Event by _time
| eval stop=strptime(stop, "%m/%d/%Y")
| eval Earliest_Count= Total - 1
| eval Latest_Count= Total + 1
| eval status=case(((Latest_count > Total) AND match(_raw, "TransactionRolledbackException")), "Down",((Latest_count > Total) AND match(_raw, "WIMSystemException")), "Down",((Latest_count > Total) AND match(_raw, "ConnectionWaitTimeoutException")), "Down",((Latest_count > Total) AND match(_raw, "\w+Exception")), "Warning", 1!=2, "OK")
| stats count by status

2. 

index=myIndex sourcetype=myscourcetype
| eval status=case( match(_raw, "TransactionRolledbackException"), "Down", match(_raw, "WIMSystemException"), "Down", match(_raw, "ConnectionWaitTimeoutException"), "Down", match(_raw, "\w+Exception"), "WARNING" , 1!=2, "OK")
| timechart count by status

Any Help or suggestion would be really appreciated!! Thanks!

Labels (1)
Tags (3)
0 Karma
1 Solution

mnarmada
Path Finder

Hello,

I have tried like below and is working for me. Thanks!!

Still I  accept any better solution than this.. haha..

index=myindex  sourcetype=mysourcetype
| stats latest(_raw) as latest_event
| eval status=case(match(latest_event, "TransactionRolledbackException"), "Down", match(latest_event, "WIMSystemException"), "latest_event", match(_raw, "ConnectionWaitTimeoutException"), "Down", match(latest_event, "\w+Exception"), "Warning", 1!=2, "OK")
| stats count by status
| eval status=case(status="OK", 0, status="Warning", 5, status="Down", 10)
| rangemap field=status low=0-4 elevated=4-6 default=severe
| eval status = replace (status,"0","OK")
| eval status = replace (status,"5","WARNING")
| eval status = replace (status,"10","DOWN")

View solution in original post

0 Karma

dmaislin_splunk
Splunk Employee
Splunk Employee

Can you upload a data sample?  Please remove or substitute any sensitive data before you provide this information.

0 Karma

mnarmada
Path Finder

Hello,

Below is the piece of data. Let me know if anything else required.

[3/14/18 0:12:41:610 EDT] 00000039 SystemErr     R  at com.ibm.io.async.ResultHandler.runEventProcessingLoop(ResultHandler.java:775)
46      3/14/18
12:12:41.610 AM 
[3/14/18 0:12:41:610 EDT] 00000039 SystemErr     R  at com.ibm.io.async.ResultHandler$2.run(ResultHandler.java:905)
47      3/14/18
12:12:41.610 AM 
[3/14/18 0:12:41:610 EDT] 00000039 SystemErr     R  at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1662)
48      3/14/18
1:00:02.465 AM  
[3/14/18 1:00:02:465 EDT] 0000006b SystemErr     R com.ibm.wcc.service.intf.ProcessingException

  

0 Karma

mnarmada
Path Finder

Hello,

I have tried like below and is working for me. Thanks!!

Still I  accept any better solution than this.. haha..

index=myindex  sourcetype=mysourcetype
| stats latest(_raw) as latest_event
| eval status=case(match(latest_event, "TransactionRolledbackException"), "Down", match(latest_event, "WIMSystemException"), "latest_event", match(_raw, "ConnectionWaitTimeoutException"), "Down", match(latest_event, "\w+Exception"), "Warning", 1!=2, "OK")
| stats count by status
| eval status=case(status="OK", 0, status="Warning", 5, status="Down", 10)
| rangemap field=status low=0-4 elevated=4-6 default=severe
| eval status = replace (status,"0","OK")
| eval status = replace (status,"5","WARNING")
| eval status = replace (status,"10","DOWN")

0 Karma

mnarmada
Path Finder

@richgalloway @dmaislin_splunk 

 

Hello All,

Can someone please help.

0 Karma
Career Survey
First 500 qualified respondents will receive a $20 gift card! Tell us about your professional Splunk journey.

Can’t make it to .conf25? Join us online!

Get Updates on the Splunk Community!

Leveraging Automated Threat Analysis Across the Splunk Ecosystem

Are you leveraging automation to its fullest potential in your threat detection strategy?Our upcoming Security ...

Can’t Make It to Boston? Stream .conf25 and Learn with Haya Husain

Boston may be buzzing this September with Splunk University and .conf25, but you don’t have to pack a bag to ...

Splunk Lantern’s Guide to The Most Popular .conf25 Sessions

Splunk Lantern is a Splunk customer success center that provides advice from Splunk experts on valuable data ...