Hi
Im working with the old exercise in python and I need help please.

The goal of this exercise is to extract information and statistical data from a log file. You can use the logfile generated by the linux kernel. You should write a python code which gives the following information:

  1. For each hour slot (like 7 to 8, 8 to 9,. . . ): the number of messages in average per day
  2. The number of messages in average per day
  3. The length of period represented by the file
  4. The average delay between two messages
  5. The longest delay between two messages

This is an example for my syslogfile

linux@ubuntu:~/Desktop$ cat /var/log/syslog > logfile1.txt

4 06:46:21 ubuntu kernel: [    0.000000]   Intel GenuineIntel
Apr  4 06:46:21 ubuntu kernel: [    0.000000]   AMD AuthenticAMD
Apr  4 06:46:21 ubuntu kernel: [    0.000000]   NSC Geode by NSC
Apr  4 06:46:21 ubuntu kernel: [    0.000000]   Cyrix CyrixInstead
Apr  4 06:46:21 ubuntu kernel: [    0.000000]   Centaur CentaurHauls
Apr  4 06:46:21 ubuntu kernel: [    0.000000]   Transmeta GenuineTMx86
Apr  4 06:46:21 ubuntu kernel: [    0.000000]   Transmeta TransmetaCPU
Apr  4 06:46:21 ubuntu kernel: [    0.000000]   UMC UMC UMC UMC
Apr  4 06:46:21 ubuntu kernel: [    0.000000] Disabled fast string operations
Apr  4 06:46:21 ubuntu kernel: [    0.000000] e820: BIOS-provided physical RAM map:

Apr  4 06:46:21 ubuntu kernel: [    5.237109] Freeing unused kernel memory: 756k freed
Apr  4 06:46:21 ubuntu kernel: [    5.237915] Write protecting the kernel text: 5960k
Apr  4 06:46:21 ubuntu kernel: [    5.238060] Write protecting the kernel read-only data: 2424k
Apr  4 06:46:21 ubuntu kernel: [    5.238065] NX-protecting the kernel data: 4280k
Apr  4 06:46:21 ubuntu kernel: [    5.301890] VMware vmxnet3 virtual NIC driver - version 1.1.29.0-k-NAPI
Apr  4 06:46:21 ubuntu kernel: [    5.315682] VMware PVSCSI driver - version 1.0.2.0-k
Apr  4 06:46:21 ubuntu kernel: [    5.378022] Floppy drive(s): fd0 is 1.44M
Apr  4 06:46:21 ubuntu kernel: [    5.381735] usb 2-1: >new full-speed USB device number 2 using uhci_hcd
Apr  4 06:46:21 ubuntu kernel: [    5.385902] Fusion MPT base driver 3.04.20
Apr  4 06:46:21 ubuntu kernel: [    5.385909] Copyright (c) 1999-2008 LSI Corporation
Apr  4 06:46:21 ubuntu kernel: [    5.388020] Fusion MPT SPI Host driver 3.04.20
Apr  4 06:46:21 ubuntu kernel: [    5.388472] mptbase: ioc0: Initiating bringup
Apr  4 06:46:21 ubuntu kernel: [    5.396026] FDC 0 is a post-1991 82077
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.