0

im new to php and i need to process some log files from a database.

I got two datasets

  1. details: User %s logged in from %s (%s)
  2. log_data: a:3:{i:0;s:2:"ba";i:1;s:9:"127.0.0.1";i:2;s:0:"";}

My idea is to format details using sprintf($details, $log_data) but i don't know what kind of format log_data is. For me it looks a bit like json.

The result should be User ba logged in from 127.0.0.1 ()

Can somebody help me please ?

Ben Ammann
  • 404
  • 4
  • 12
  • 1
    Why are you saving the data as serialized strings instead of having different columns for the different values (like a database is meant to be used)? In the way you have it now, you won't be able to query the database for specific users or do any grouping/joins etc – M. Eriksson Apr 27 '19 at 15:02
  • The duplicate answered my question, thanks! @MagnusEriksson jeah ... i'm writing a prometheus exporter for a shitty cms, can't change the data structure :( – Ben Ammann Apr 27 '19 at 15:05

0 Answers0