Skip to main content
Sumo Logic

Collect Logs and Metrics for Jenkins

How to collect logs and metrics for the Sumo App for Jenkins.

This page has instructions for setting up log and metric collection for the Sumo Logic App for Jenkins.

  1. Configure a Hosted Collector, or select an existing hosted collector to use.
  2. Add an HTTP Source to the hosted collector you created or selected. Note the HTTP source URL. It will look something like:
  3. In the Jenkins console, go to Manage Jenkins > Manage Plugins.
  4. Click the Available tab.
  5. Search for "Sumologic Publisher".
  6. Click "Sumologic Publisher".
  7. Click Download now and install after restart. You may need to restart Jenkins for the plugin to show up.
  8. Go to Manage Jenkins > Configure System.
  9. Search for the "Sumologic Jenkins plugin" field.
  10. Enter the HTTP Source URL from step 2.
  11. Click Apply.
  12. Click Save.
  13. For each Freestyle project that you want to monitor, add a Post Build Action. (Configure > Post Build Actions > Sumologic Build Logger) so that logs can be sent to Sumo Logic Hosted Collector after completion of build.

Query samples 

Build Failure - Outlier (log query)

| json field=_raw "name" as name
| json field=_raw "result" as result 
| where result="FAILURE"
| json field=_raw "number" as number
| json field=_raw "duration" as duration_ms
| number(duration_ms)
| json field=_raw "start_time" as start_time
| formatDate(fromMillis(start_time), "MM-dd-yyyy HH:mm:ss") as date_time
| timeslice 1h
| count by _timeslice
| outlier _count direction=+
| where _count_violation =1


MaxWaitingTime (metric query)

_sourceCategory=jenkins  MaxWaitingTime 
| json field=_raw "queue.NumItemsInQueue" as NumItemsInQueue
| json field=_raw "queue.NumBlockedItemsInQueue" as NumBlockedItemsInQueue
| json field=_raw "queue.MaxWaitingTime" as MaxWaitingTime
| json field=_raw "queue.AverageWaitingTime" as AverageWaitingTime
| json field=_raw "slaves.numberOfSlaves" as numberOfSlaves
| json field=_raw "slaves.numberOfExecutors" as numberOfExecutors
| json field=_raw "slaves.numberOfFreeExecutors" as numberOfFreeExecutors
| withtime MaxWaitingTime
| most_recent(MaxWaitingTime_withtime) as current_max_waiting_time