Counting SQL guids from a server log and printing stats
Your timer function should probably go away, to use the built-in timeit instead; or at least timer should wrap timeit.

I'm unclear on why re1 and re2 are separate. Just have them in the same string. If you want to make it clear that they're separate parts of the regex, you could show the construction of the regex as a concatenation, i.e.

rg = re.compile('.*?'  # Prefix to do foo
                # This is a SQL GUID
                '([A-Z0-9]{8}-[A-Z0-9]{4}-[A-Z0-9]{4}-[A-Z0-9]{4}-[A-Z0-9]{12})',
                re.IGNORECASE | re.DOTALL)


Also, you should not have an outer group on that regex.

Your else after return guid1 is redundant, since the previous block has already returned.

lines = dict() should be lines = {}. There's a reason for this: generally, shorter code is considered more "Pythonic" (as long as it doesn't become arcane or difficult to understand). A dictionary literal is short, simple, and easy to understand.

Here:

if str(element) in line:


You've already stated in the function doc that element is assumed to be a string, so you don't need to convert it using str.

Here:

unique_ids_dict[element] = find_device_IDs(path, element)


Your data structure use is a little strange. You're constructing a dictionary by element of single-key dictionaries by element of GUIDs. It would probably make more sense to change find_device_IDs such that it doesn't return a dictionary, and instead just returns a set.

Speed tips:


Sort out your data structure strategy, mentioned above
Don't re-compile your regex every time an inner function is called. Compile your regex once, at the global level


This:

num_exceptions_dict = dict()
    for elem in search_list:
        num_exceptions_dict[elem] = find_num_occurences(path, elem, 
            search_with_in_deviceID, list(unique_ids_dict[elem].values())[0])


should probably be reduced to something like

num_exceptions_dict = {
    elem: find_num_occurences(path, elem, search_with_in_deviceID,
                              unique_ids_dict[elem].values())
    for elem in search_list
}


The performance-affecting change is to avoid re-constructing an inner list. But there's something more sinister going on there. A dictionary is unordered, but you're taking element [0] of an arbitrarily ordered list of values(). If you actually do intend to pull a non-deterministic value from the dictionary, then fine; but this is probably not your intention.

This:

search_with_in_deviceID = ["Exception occurred", "Packet record has been added"]


should be a tuple instead of a list, since you aren't changing it; so:

search_within_device_ID = ('Exception occurred', 'Packet record has been added')


I'm going to suggest that you attempt to address the issues that I've raised, above, in particular with respect to the structure of your dictionary and the non-deterministic behaviour of your values call; and then submit a new question so that further performance issues may be addressed.