Hi,
Here is a fully functioning example:
def update_title(m)
title = m["title"]
filename = m["filename"]
match = string.extract(pattern="podcast\s*([0-9]+).mp3",filename)
podnum = match["1"]
[("title","#{title} #{podnum}")]
end
s = single("podcast 1313.mp3")
s = on_metadata(fun(m)->log("BEFORE #{m}"),s)
s = map_metadata(update_title,s)
s = on_metadata(fun(m)->log("AFTER #{m}"),s)
output.dummy(fallible=true,s)
You should be able to adapt it immediately to your script. If it does
not work as expected, you need to learn the usual debugging
techniques: first, logging the metadata at various points like I did
above; next, using sample scripts, one-liners and interactive mode to
try simple expressions and make sure they behave as expected.
Have fun,
David
------------------------------------------------------------------------------
All of the data generated in your IT infrastructure is seriously valuable.
Why? It contains a definitive record of application performance, security
threats, fraudulent activity, and more. Splunk takes this data and makes
sense of it. IT sense. And common sense.
http://p.sf.net/sfu/splunk-d2d-c2
_______________________________________________
Savonet-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/savonet-users