Intro to sysdig in 15 minutes

17
Luca Marturana, Software engineer Sysdig in 15 minutes

Transcript of Intro to sysdig in 15 minutes

Page 1: Intro to sysdig in 15 minutes

Luca Marturana, Software engineerSysdig in 15 minutes

Page 2: Intro to sysdig in 15 minutes

Information presented is confidential

Containers

• Easy to bundle apps

• Easy to replicate

environments

• Bridge from app

developers to ops

engineers

Page 3: Intro to sysdig in 15 minutes

Information presented is confidential

Containers in production: new challenges

• Orchestration • Monitoring • Troubleshooting • Logging • Security

Page 4: Intro to sysdig in 15 minutes

Information presented is confidential

Troubleshooting

• network: tcpdump, netstat

• file: lsof • memory/cpu:

top, ps

They don’t play well with containers

Page 5: Intro to sysdig in 15 minutes

Information presented is confidential

Sysdig architecture

Kernel

Container1

Docker

Container2

runc

Container3

rkt

sysdig

Docker

Capture and analysis

Instrumentation through kernel

module

Page 6: Intro to sysdig in 15 minutes

Information presented is confidential

sysdig

• Capture system events, filter them, run useful scripts

• Tracefiles for postponed analysis • Native support for: Docker, Kubernetes,

Mesos, rkt and so on • Open Source

Page 7: Intro to sysdig in 15 minutes

Information presented is confidential

Two Flavours

• event filtering and printing on screen

• apply bundled or custom chisels

• save tracefiles for later analysis

• easy to use interface

• tabular or graphic views for various purposes

sysdig csysdig

Page 8: Intro to sysdig in 15 minutes

Demo

Page 9: Intro to sysdig in 15 minutes

Hands on!

Page 10: Intro to sysdig in 15 minutes

Information presented is confidential

Setup

Install sysdig: https://www.sysdig.org/install/

Download captures: http://go.sysdig.com/ccwfs-captures

Page 11: Intro to sysdig in 15 minutes

Information presented is confidential

Exercise 1

Somebody is trying to log into our machine, find his IP!

Capture: trace01.scap

Page 12: Intro to sysdig in 15 minutes

Information presented is confidential

Solution 1

sysdig -r trace01.scap -c topconns fd.port = 22

sysdig -r trace01.scap -c spy_syslog proc.name = sshd

Page 13: Intro to sysdig in 15 minutes

Information presented is confidential

Exercise 2

Find the failing HTTP requests What’s wrong in them?

Capture: trace02.scap

Page 14: Intro to sysdig in 15 minutes

Information presented is confidential

Solution 2

sysdig -r trace02.scap -c httplog|grep code=5

csysdig -r trace02.scap Containers -> nginx -> Connections

Page 15: Intro to sysdig in 15 minutes

Information presented is confidential

Exercise 3

Capture: trace03.scap

Weird syscall behaviourHint: look csysdig Errors view

Page 16: Intro to sysdig in 15 minutes

Information presented is confidential

Solution 3

sysdig -r trace03.scap -c topscalls

sysdig -r trace03.scap -c echo_fds proc.name python and fd.name

contains myscript.py

sysdig -r trace03.scap proc.name = python and evt.type = close

Page 17: Intro to sysdig in 15 minutes

Thank You!